※ 글쓴이는 취미로 코딩을 익혀보는 사람이라 정확하지 않은 내용을 담고 있을 수 있다 ※
이번에 볼 문제는 백준 14005번 문제인 Small Ping Pong Tournament이다.
문제는 아래 링크를 확인하자.
https://www.acmicpc.net/problem/14005
14005번: Small Ping Pong Tournament
The input will start with a line containing a single integer N. The following 2N lines will each contain an integer indicating the total number of points scored by some player. Dudu's score is given first. 0 ≤ N ≤ 3. All scores will be non-negative in
www.acmicpc.net
14006번 문제에서 N의 제한이 작아진 문제이다. 풀이는 같으므로 해당 글을 참고하자.
아래는 제출한 소스코드이다.
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N; cin >> N;
if (N == 0) {
cout << "YES";
return 0;
}
int total = (1 << N);
int dudu, mn = 1000000007; cin >> dudu;
for (int i = 1; i < total; i++) {
int x; cin >> x;
mn = min(mn, x);
}
if (mn <= dudu) cout << "YES";
else cout << "NO";
}
728x90
'BOJ' 카테고리의 다른 글
[BOJ 14008 // C++] Medium Weird Measurements (0) | 2022.05.13 |
---|---|
[BOJ 14006 // C++] Large Ping Pong Tournament (0) | 2022.05.12 |
[BOJ 14004 // C++] ICPC (0) | 2022.05.11 |
[BOJ 1013 // C++] Contact (0) | 2022.05.10 |
[BOJ 16650 // C++] Counting Stairs (0) | 2022.05.09 |