标签:col pre ota 12px ora nes ted ane memory
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 127904 Accepted Submission(s): 50515
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <map> using namespace std ; #define maxn 2000 char num[30] , str[maxn][30] ; int dp[maxn] ; int main(){ int t ; while(~scanf("%d" , &t) && t!=0){ int total = 0 ; memset(dp , 0 , sizeof(dp)) ; for(int i=0 ; i<t ; i++){ scanf("%s" , num) ; int flag = 0 ; for(int j=0 ; j< total ; j++){ if(!strcmp(num , str[j])){ dp[j] ++ ; flag =1 ; } } if(!flag){ strcpy(str[total] , num) ; dp[total] ++ ; total ++ ; } } int max_num = -1 ; int max_flag ; for(int i=0 ; i<total ; i++){ if(dp[i] > max_num){ max_num = dp[i] ; max_flag = i ; } } printf("%s\n" , str[max_flag]) ; } return 0 ; }
标签:col pre ota 12px ora nes ted ane memory
原文地址:http://www.cnblogs.com/yi-ye-zhi-qiu/p/7658597.html