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 |
这么弱的数据,怎么竟然还要47s?//============================================================================ // Name : main2028.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; int main() { int N, Quo; while(1){ cin >> N >> Quo; if(N==0 && Quo==0) return 0; int num[128] = {0}; for(int i = 0; i < N; i++){ int rubbish; cin >> rubbish; for(int j = 0; j < rubbish; j++){ int temp; cin >> temp; num[temp]++; } } int res; int max = 0; bool can = false; for(int i = 1; i < 128; i++){ if(num[i] >= Quo && num[i] > max){ can = true; max = num[i]; res = i; //break; } } if(can) cout << res << endl; else cout << 0 << endl; } //cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator