| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
怎么又是WA?#include<stdio.h>
#include<string.h>
main()
{
char cand[22][82],party[22][82],vote[10002][82];
int n,m,a[20],max,pos,i,j,pos2,min;
scanf("%d ",&n);
memset(a,0,sizeof(a));
for(i=0;i<n;i++)
{
gets(cand[i]);
gets(party[i]);
}
scanf("%d ",&m);
for(i=0;i<m;i++)
{
gets(vote[i]);
for(j=0;j<n;j++)
if(strcmp(vote[i],cand[j])==0)
a[j]++;
}
max=0;
min=10000;
for(i=0;i<n;i++)
{
if(a[i]>max)
{
max=a[i];
pos=i;
}
if(a[i]<min)
{
min=a[i];
pos2=i;
}
}
if(max==min)
printf("tie\n");
else
puts(party[pos]);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator