Codeforces Round #316 (Div. 2A) 570A Elections
题目:Click here
1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int INF = 0x3f3f3f3f; 5 const int M = 1178706+3; 6 7 int n, m; 8 int a[105]; 9 int b[105]; 10 int main() { 11 while( ~scanf("%d%d", &n, &m ) ) { 12 memset( b, 0, sizeof(b) ); 13 for( int i=1; i<=m; i++ ) { 14 for( int j=1; j<=n; j++ ) 15 scanf("%d", &a[j] ); 16 int maxi = n; 17 for( int j=n-1; j>0; j-- ) 18 if( a[maxi] <= a[j] ) 19 maxi = j; 20 b[maxi]++; 21 } 22 int maxc = n; 23 for( int i=n-1; i>0; i-- ) 24 if( b[maxc] <= b[i] ) 25 maxc = i; 26 printf("%d\n", maxc ); 27 } 28 return 0; 29 }