• 杭电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;
    }

  • 相关阅读:
    redis常用数据类型与命令
    bcb6重启应用程序
    MySQL 关联查询  外连接 { LEFT| RIGHT } JOIN
    MySQL 关联查询 内连接
    MySql子查询
    MySql单表查询
    表级操作语句
    库级操作语句
    14.正则表达式、re模块、元字符
    13.生成器、迭代器、 模块、包和包管理
  • 原文地址:https://www.cnblogs.com/wft1990/p/4299930.html
Copyright © 2020-2023  润新知