1917
来源:互联网 发布:中国上市装饰公司知乎 编辑:程序博客网 时间:2024/06/05 10:14
#include<stdio.h>
#include<string.h>
char name[1000][81];
char partyname[1000][81];
struct str{
char name[81];
char party[81];
int count;
}str1[256];
int main()
{
int n,a,i,m,j,h=0;//n表示竞选的人数,m投票的树木
/*scanf("%81[^n]/n",&n); */
while(scanf("%d/n",&n)!=EOF)
{
for(i=0;i<n;i++)
{
gets(str1[i].name);
gets(str1[i].party);
}
scanf("%d/n",&m);
for(j=0;j<m;j++)
gets(name[j]);
for(j=0;j<n;j++)
{
int d=0;
for(a=0;a<m;a++)
if(strcmp(str1[j].name,name[a])==0)
d++;
str1[j].count=d;
}
int max=0,b=0;
for(j=0;j<n;j++)
{
if(max<str1[j].count)
{
max=str1[j].count ;
b=j;
}
}
for(j=0;j<n;j++)
{
if(max==str1[j].count&&b!=j)
{
b=-1;
break;
}
}
if(b==-1)
strcpy(partyname[h],"tie");
else
strcpy(partyname[h],str1[b].party );
h++;
str1[b].count=0;
}
for(j=0;j<h;j++)
printf("%s/n",partyname[j]);
return 0;
}//////////////////runtime ................
- 1917
- poj 1917
- poj 1917
- 哈尔滨工业大学 1917
- 1917Automatic Poetry
- poj 1917 Automatic Poetry
- POJ 1917 Automatic Poetry
- Hoj 1917 Peaceful Commission
- 1917: 支配值数目
- HOJ 1917 Peaceful Commission
- POJ 1917 字符串替换
- ZZULIOJ 1917 E
- 【zzulioj 1917 二分+vector】
- ZZULI 1917: E
- ZZULIOJ 1917: E
- zzulioj-1917-E【思维】
- ZZULIOJ-【1917: E】
- zzuli oj 1917: E
- SQL Server2000 解密存储过程
- 15 个最酷的 Firefox 技巧
- BizTalk Server 2006 Web 服务
- 多附件上传页面代码
- 村规(春天花花同学会)
- 1917
- linux的作业控制
- J2EE学习经验交流
- VSLua工具
- 微型嵌入式GUI-应用开发-TEXTBOX
- 一个初学者..
- 登陆现象详解
- 重载、覆盖与隐藏简单剖析
- Window 消息大全使用详解