2 条题解
-
4大金狮 (mengqingyu) LV 10 @ 2024-11-22 18:51:58
#include <bits/stdc++.h> using namespace std; int numa[1000],numb[1000]; int cnta[1000],cntb[1000]; int main(){ string a,b; cin>>a>>b; if(a.size()!=b.size()){ cout<<"NO\n"; return 0; } for(int i = 0 ; i < a.size() ; i++){ /* if(s[i] == 'A') s3[i] = s3[i] + 'Z'; else s3[i] = s3[i] + (s[i] + 1); a[s2[i]]++; b[s3[i]]++; an=1; */ numa[a[i]]++; numb[b[i]]++; } for(int i = 65; i <=90; i++){ cnta[numa[i]]++; cntb[numb[i]]++; } for(int i=1;i<=100;i++){ if(cnta[i]!=cntb[i]){ cout<<"NO\n"; return 0; } } cout<<"YES\n"; return 0; }
-
-52024-11-22 18:47:47@
bydongliyang
teacher: huhe
from:huhe&&dongliyang
/************************* from huhe&&dongliyang *************************/ #include<iostream> #include<ostream> using namespace std; string a,b; int suma[3000000],sumb[3000000],cnta[3000000],cntb[3000000]; int main(){ cin>>a>>b; if(a.size()!=b.size()){ cout<<"NO"; return 0; } for(int i=0;i<a.size();i++){ suma[a[i]]++; sumb[b[i]]++; } for(int i=65;i<=90;i++){ cnta[suma[i]]++; cntb[sumb[i]]++; } for(int i=1;i<=100;i++){ if(cnta[i]!=cntb[i]){ cout<<"NO"; return 0; } } cout<<"YES"; }
- 1
信息
- ID
- 1102
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 8
- 标签
- 递交数
- 188
- 已通过
- 36
- 上传者