hdu-1004-Let the Balloon Rise
来源:互联网 发布:手机有mac地址吗 编辑:程序博客网 时间:2024/06/16 16:37
#include<stdio.h>
#include<string.h>
int b[1000];
char a[1000][16];
/*int cmp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}*/
int main()
{
int n,i,j,max,m;
while(scanf("%d",&n)&&n!=0)
{
memset(b,0,sizeof(b));
scanf("%s",a[0]);
for(j=0,i=1;i<n;i++)
{
scanf("%s",a[i]);
for(j=0;j<i;j++)
if(strcmp(a[j],a[i])==0)
b[j]++;
}
// qsort(b,j,sizeof(b[0]),cmp);
max=b[0];
m=0;
for(i=1;i<j;i++)
if(b[i]>max)
{
m=i;
max=b[i];
}
printf("%s\n",a[m]);
}
return 0;
}
#include<string.h>
int b[1000];
char a[1000][16];
/*int cmp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}*/
int main()
{
int n,i,j,max,m;
while(scanf("%d",&n)&&n!=0)
{
memset(b,0,sizeof(b));
scanf("%s",a[0]);
for(j=0,i=1;i<n;i++)
{
scanf("%s",a[i]);
for(j=0;j<i;j++)
if(strcmp(a[j],a[i])==0)
b[j]++;
}
// qsort(b,j,sizeof(b[0]),cmp);
max=b[0];
m=0;
for(i=1;i<j;i++)
if(b[i]>max)
{
m=i;
max=b[i];
}
printf("%s\n",a[m]);
}
return 0;
}
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- Hdu 1004 - Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004--Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise STL
- JAVA异常 getOutputStream() has already been called for this response
- 常见VC异常
- ios Crash Log 分析汇总
- Oracle监听主机设置为IP地址,报ORA-12545错误或连接超时错误
- ora-22992 通过DBLINK 访问远程CLOB表问题
- hdu-1004-Let the Balloon Rise
- 关于Zxing二维码开发的问题
- 对 Linux 专家非常有用的 20 个命令
- Linux useradd与用户管理相关的配置文件
- 【关闭Win7系统自动安装驱动程序功能】
- Xmlserialization
- JSTL标签(七)
- 吉哥系列故事——完美队形I
- 8#10 - 杭州邀请赛 重现