Commend

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

int n, m;
int a[55][55];
int b[55];
int c[55];

int main() {
freopen("commend.in", "r", stdin);
freopen("commend.out", "w", stdout);
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
int id = 0;
int cnt = 0;
for (int j = 1; j <= m; j++) {
scanf("%d", &a[i][j]);
if (a[i][j] > cnt) {
cnt = a[i][j];
id = j;
}
}
b[i] = id;
}
for (int i = 1; i <= n; i++) {
c[b[i]]++;
}
int id = 0;
int cnt = 0;
for (int i = 1; i <= m; i++) {
if (c[i] > cnt) {
cnt = c[i];
id = i;
}
}
printf("%d\n", id);
return 0;
}