标签:tin pre mem tle getchar gets nes next acm
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004
题目:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 119039 Accepted Submission(s): 46654
# include <stdio.h> # include <string.h> struct{ char name[50]; int n,l; }co[1010]; int main () { int n,i,j,max,num; while(scanf("%d",&n),n) { getchar(); for(i=0;i<n;i++) { gets(co[i].name); co[i].l=strlen(co[i].name); co[i].n=1; } max=0;num=0; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(co[i].l==co[j].l && strcmp(co[i].name,co[j].name)==0) co[i].n++; } if(max<co[i].n) { max=co[i].n; num=i; } } puts(co[num].name); } return 0; }
标签:tin pre mem tle getchar gets nes next acm
原文地址:http://www.cnblogs.com/love-sherry/p/6745115.html