Skip to content

Commit

Permalink
24-04-04 μ €μšΈ
Browse files Browse the repository at this point in the history
  • Loading branch information
makehard23 committed Apr 4, 2024
1 parent 66184fa commit 5e1f263
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions yuyu0830/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) | - |

---
34 changes: 34 additions & 0 deletions yuyu0830/μˆ˜ν•™/2437.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
#include <queue>

using namespace std;

int main() {
priority_queue<int, vector<int>, greater<int> > 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);
}

0 comments on commit 5e1f263

Please sign in to comment.