zoukankan      html  css  js  c++  java
  • 杭电1004

    #include<stdio.h>
    #include<string.h>
    char a[1000][16];//建立二维数组
    static int b[1000];//建立存储对应字符串出现的次数
    int main()
    {
             int i,j,max,n,m;
             while(scanf("%d",&n)!=EOF){
                       getchar();
                       if(n==0) break;
                       for(i=1;i<=n;i++)
                       {
                                b[i]=0;
                                scanf("%s",a[i]);
                       }
                       for(i=1;i<=n;i++)
                       {
                                for(j=1;j<=n;j++)
                                {
                                         if(strcmp(a[i],a[j])==0)
                                         b[i]++;
                                }
                       }
                       m=1;
                       max=b[1];
                       for(i=2;i<=n;i++)
                       {
                                if(b[i]>max)
                                {
                                         max=b[i];
                                         m=i;
                                }
                       }
                       printf("%s ",a[m]);
             }
             return 0;
    }

  • 相关阅读:
    Cache 在选择的几点思考
    英语12种记忆单词的方法
    对啊英语音标---二、ghywr这些辅音怎么发音
    日常英语---八、REBOOT
    日常英语---一、纸质版还是电子版
    日常英语---四、vis.js是什么
    日常英语---二、注册google的api的key
    日常英语---七、[Updated November 14 at 4:10 PM PST] Scheduled Game Update
    日常英语---六、Maplestory Illium
    日常英语---三、网页查找单词用什么
  • 原文地址:https://www.cnblogs.com/wft1990/p/4299930.html
Copyright © 2011-2022 走看看