Title Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1505
Test instructions: The trick is that the number of occurrences of each letter in a line of characters is different, and the word is cool.
Problem-solving ideas: Look at the test instructions, combined with the case, you can understand that only need to count the number of characters in the string in the line.
AC Code:
#include <iostream>#include<cstdio>#include<cstdlib>#include<cstring>using namespacestd;Const intm= -+5;intN,ans,a[m],b[m];CharS[m];intMain () {intN,ca=1; while(SCANF ("%d", &n) = =1) {ans=0; for(intI=0; i<n;i++) {memset (A,0,sizeof(a)); memset (b,0,sizeof(b)); intf=1; scanf ("%s", s); intlen=strlen (s); if(len==1)Continue; for(intj=0; j<len;j++) a[s[j]-'a']++; for(intj=0;j< -; j + +) { if(A[j]) b[a[j]]++; if(b[a[j]]>1) {f=0; Break;} } if(f) ans++; } printf ("Case %d:%d\n", ca++, ans); } return 0;}
CSU 1505 Cool word Hunan Province Race tenth session topic