北京师范大学珠海分校
Judge Online of ACM ICPC
1066 爱学习的辉蛋
C语言版
Judge Online of ACM ICPC
1066 爱学习的辉蛋
C语言版
- #include <stdio.h>
- #include <string.h>
- int main(){
- int i,j,m,n,max,s[201]={0};
- char a[201][11];
- while(1){
- max=0;
- scanf("%d",&n);
- if (n==0) break;
- for (i=1;i<=n;i++) scanf("%s",&a[i]);
- for (i=1;i<=n;i++)
- for (j=1;j<=n-i;j++)
- if (strcmp(a[i],a[j+i])==0) s[i]++;
- for (i=1;i<=n;i++){
- if (s[i]>max){
- m=i;
- max=s[i];
- }
- }
- printf("%s/n",a[m]);
- for (i=1;i<=n;i++) s[i]=0;
- }
- return 0;
- }