| ||||||||||
| 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 | |||||||||
Re:抛砖引玉~~~各位高手帮我这个小水牛看看In Reply To:抛砖引玉~~~各位高手帮我这个小水牛看看 Posted by:laofuzi123 at 2009-07-15 20:01:26 > /*2643*/
> #include <stdio.h>
> #include <string.h>
> char s2[10000][82];
> void main()
> {
> int i,j,n,m,count[22],max,min,x,y;
> char s[21][82],s1[21][82];
> scanf("%d",&n);
> max=0;
> min=100000;
> memset(count,0,sizeof(count));
> getchar();
> for(i=0;i<n;i++)
> {
> gets(s[i]);
> gets(s1[i]);
> }
> scanf("%d\n",&m);
> for(i=0;i<m;i++)
> {
> gets(s2[i]);
> }
> for(i=0;i<n;i++)
> {
> for(j=0;j<m;j++)
> {
> if(strcmp(s[i],s2[j])==0)
> {
> count[i]++;
> }
> }
> if(count[i]>max)
> {
> max=count[i];
> x=i;
> }
> if(count[i]<min)
> {
> min=count[i];
> y=i;
> }
> }
> if(max==min)
> {
> printf("tie\n");
> }
> else
> {
> puts(s1[x]);
> }
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator