标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 107810 Accepted Submission(s): 41848
1 #include<iostream> 2 #include<cstring> 3 #include<map> 4 #include<string.h> 5 #include<cstdio> 6 #include<cmath> 7 #include<algorithm> 8 typedef long long ll; 9 using namespace std; 10 int main() 11 { 12 map<string,int>str; 13 int n; 14 string a; 15 while(scanf("%d",&n)!=EOF) 16 { 17 if(n==0) 18 break; 19 int sum=0; 20 str.clear(); 21 for(int i=0;i<n;i++) 22 { 23 cin>>a; 24 str[a]++; 25 sum=max(sum,str[a]); 26 } 27 map<string,int>::iterator it; 28 for(it=str.begin();it!=str.end();it++) 29 { 30 if(sum==it->second) 31 { 32 cout<<it->first<<endl; 33 } 34 } 35 } 36 }
标签:
原文地址:http://www.cnblogs.com/Aa1039510121/p/5831025.html