diff --git a/yuyu0830/README.md b/yuyu0830/README.md index b957bf0..c6d506a 100644 --- a/yuyu0830/README.md +++ b/yuyu0830/README.md @@ -6,4 +6,8 @@ | 2차시 | 2024.03.15 | 탐색 | [숨바꼭질 2](https://www.acmicpc.net/problem/12851) | - | | 3차시 | 2024.03.20 | 탐색 | [하이퍼 토마토](https://www.acmicpc.net/problem/17114) | - | | 4차시 | 2024.03.26 | 분할정복 | [행렬 제곱](https://www.acmicpc.net/problem/10830) | - | +| 5차시 | 2024.03.29 | 탐색 | [스도쿠](https://www.acmicpc.net/problem/2239) | - | +| 6차시 | 2024.04.03 | 자료구조 | [나만 안되는 연애](https://www.acmicpc.net/problem/14621) | - | +| 7차시 | 2024.04.04 | 저울 | [저울](https://www.acmicpc.net/problem/2437) | - | + --- diff --git "a/yuyu0830/\354\210\230\355\225\231/2437.cpp" "b/yuyu0830/\354\210\230\355\225\231/2437.cpp" new file mode 100644 index 0000000..cfba534 --- /dev/null +++ "b/yuyu0830/\354\210\230\355\225\231/2437.cpp" @@ -0,0 +1,34 @@ +#include +#include + +using namespace std; + +int main() { + priority_queue, greater > q; + int n; cin >> n; + + for (int i = 0; i < n; i++) { + int t; cin >> t; + q.push(t); + } + + bool first = true; + int max = 1; + + while (!q.empty()) { + int t = q.top(); + q.pop(); + + // when First number isn't 1 + if (first && t != 1) + break; + + first = false; + + // can search more? + if (t <= max) max += t; + else break; + } + + printf("%d\n", max); +} \ No newline at end of file