-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ_1268.cpp
More file actions
48 lines (43 loc) · 765 Bytes
/
BOJ_1268.cpp
File metadata and controls
48 lines (43 loc) · 765 Bytes
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
46
47
48
// 22 / 3 / 2
#include <iostream>
#include <vector>
using namespace std;
int n;
vector<vector<int>> classes;
vector<int> scores;
int main(void)
{
cin >> n;
classes.assign(n, vector<int>(5, 0));
scores.assign(n, 0);
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 5; j++)
cin >> classes[i][j];
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
for (int k = 0; k < 5; k++)
{
if (classes[i][k] == classes[j][k])
{
scores[i]++;
break;
}
}
}
}
int maxStudent = 0, maxScore = 0;
for (int i = 0; i < n; i++)
{
if (scores[i] > maxScore)
{
maxScore = scores[i];
maxStudent = i + 1;
}
}
cout << maxStudent;
return 0;
}