-
Notifications
You must be signed in to change notification settings - Fork 4
/
Lv1_로또의최고순위와최저순위.cpp
47 lines (36 loc) · 833 Bytes
/
Lv1_로또의최고순위와최저순위.cpp
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
#include <string>
#include <iostream>
#include <vector>
using namespace std;
bool check[46];
vector<int> solution(vector<int> lottos, vector<int> win_nums) {
vector<int> answer;
int count = 0;
int zero = 0;
for (auto a : lottos) {
check[a] = true;
if (a == 0)
++zero;
}
for (auto a : win_nums) {
if (check[a])
++count;
}
int min = 7 - count;
if (min == 7)
min = 6;
int max = 7 - (count + zero);
if (max == 7)
max = 6;
answer.push_back(max);
answer.push_back(min);
return answer;
}
int main() {
vector<int> lottos = { 1,2,3,4,5,6 };
vector<int> win_nums = { 7,8,9,10,11,12 };
vector<int> ans = solution(lottos, win_nums);
for (auto a : ans)
cout << a << " ";
return 0;
}