Codeforces Round #666 (Div. 2) A. Juggling Letters
程序员文章站
2022-04-30 22:48:44
...
problem
solution
统计各个字符数,只要都是n的倍数就可以了
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int num[250];
int main(){
int T; cin>>T;
while(T--){
int n; cin>>n;
memset(num,0,sizeof(num));
for(int i = 1; i <= n; i++){
string s; cin>>s;
for(int i = 0; i < s.size(); i++)
num[s[i]-'A']++;
}
int ok = 1;
for(int i = 0; i <= 100; i++){
if(num[i]%n!=0){
ok = 0; break;
}
}
if(ok)cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}
推荐阅读
-
Codeforces Round #655 (Div. 2) A. Omkar and Completion
-
Codeforces Round #659 (Div. 2) A. Common Prefixes(字符串,思维)
-
Codeforces Round #666 (Div. 2)C - Multiples of Length(错位相减)
-
B. Power Sequence(数学+枚举)Codeforces Round #666 (Div. 2)
-
Codeforces Round #666 (Div. 2)B. Power Sequence(等比数列)
-
Educational Codeforces Round 93 (Rated for Div. 2) A. Bad Triangle
-
Codeforces Round #664 (Div. 2) A. Boboniu Likes to Color Balls
-
Codeforces Round #156 (Div. 2)-A. Greg's Workout_html/css_WEB-ITnose
-
Codeforces Round #107 (Div. 2)-A. Soft Drinking_html/css_WEB-ITnose
-
Codeforces Round #191 (Div. 2)-A. Flipping Game_html/css_WEB-ITnose