//https://www.acmicpc.net/problem/5597 #include <iostream> | |
using namespace std; | |
int max(int a, int b) { | |
return a>b ? a : b; | |
} | |
int min(int a, int b) { | |
return a<b ? a : b; | |
} | |
bool chk[31]; | |
int main(){ | |
for(int i=0; i<28; i++) { | |
int x; | |
cin >> x; | |
chk[x]=1; | |
} | |
int ans1=0, ans2=0; | |
for(int i=1; i<=30; i++){ | |
if(chk[i]==0){ | |
if(ans1==0) ans1=i; | |
else { | |
ans2=i; | |
break; | |
} | |
} | |
} | |
cout << max(ans1, ans2) << '\n'<< min(ans1, ans2); | |
return 0; | |
} |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
180615_다음 큰 숫자 (0) | 2018.06.15 |
---|---|
180608_1076_저항 (0) | 2018.06.08 |
180604_10769_행복한지 슬픈지 (0) | 2018.06.04 |
180602_4690_완전 세제곱 (0) | 2018.06.02 |
180601_1934_최소공배수 (0) | 2018.06.01 |
//https://www.acmicpc.net/problem/5597 #include <iostream> | |
using namespace std; | |
int max(int a, int b) { | |
return a>b ? a : b; | |
} | |
int min(int a, int b) { | |
return a<b ? a : b; | |
} | |
bool chk[31]; | |
int main(){ | |
for(int i=0; i<28; i++) { | |
int x; | |
cin >> x; | |
chk[x]=1; | |
} | |
int ans1=0, ans2=0; | |
for(int i=1; i<=30; i++){ | |
if(chk[i]==0){ | |
if(ans1==0) ans1=i; | |
else { | |
ans2=i; | |
break; | |
} | |
} | |
} | |
cout << max(ans1, ans2) << '\n'<< min(ans1, ans2); | |
return 0; | |
} |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
180615_다음 큰 숫자 (0) | 2018.06.15 |
---|---|
180608_1076_저항 (0) | 2018.06.08 |
180604_10769_행복한지 슬픈지 (0) | 2018.06.04 |
180602_4690_완전 세제곱 (0) | 2018.06.02 |
180601_1934_최소공배수 (0) | 2018.06.01 |