-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1-36.cpp
More file actions
46 lines (43 loc) · 697 Bytes
/
1-36.cpp
File metadata and controls
46 lines (43 loc) · 697 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
// 모의고사
// 2019.08.30
#include<vector>
#include<algorithm>
using namespace std;
vector<int> solution(vector<int> answers) {
vector<int> answer;
int no1[5] = { 1,2,3,4,5 };
int no2[8] = { 2,1,2,3,2,4,2,5 };
int no3[10] = { 3,3,1,1,2,2,4,4,5,5 };
int c1 = 0;
int c2 = 0;
int c3 = 0;
for (int i = 0; i < answers.size(); i++)
{
if (no1[i % 5] == answers[i])
{
c1++;
}
if (no2[i % 8] == answers[i])
{
c2++;
}
if (no3[i % 10] == answers[i])
{
c3++;
}
}
int maximum = max(max(c1, c2), c3);
if (c1 == maximum)
{
answer.push_back(1);
}
if (c2 == maximum)
{
answer.push_back(2);
}
if (c3 == maximum)
{
answer.push_back(3);
}
return answer;
}