Skip to content

Commit

Permalink
65-9kyo-hwang
Browse files Browse the repository at this point in the history
  • Loading branch information
9kyo-hwang committed Sep 11, 2024
1 parent b9a906d commit bf8edb7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions 9-kyo-hwang/Greedy/λ””νŽœμŠ€ κ²Œμž„.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <string>
#include <vector>
#include <queue>

using namespace std;

int solution(int N, int K, vector<int> InEnemies)
{
priority_queue<int> NumofEnemiesBlocked;
int Round = 0;

for(int Enemy : InEnemies)
{
N -= Enemy;
NumofEnemiesBlocked.emplace(Enemy);

if(N < 0)
{
if(K == 0)
{
break;
}

N += NumofEnemiesBlocked.top();
NumofEnemiesBlocked.pop();
K--;
}

Round++;
}

return Round;
}
3 changes: 2 additions & 1 deletion 9-kyo-hwang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@
| 61μ°¨μ‹œ | 2024.8.08 | Implementation | [ν…Œμ΄λΈ” ν•΄μ‹œ ν•¨μˆ˜](https://school.programmers.co.kr/learn/courses/30/lessons/147354) | [#214](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/214) |
| 62μ°¨μ‹œ | 2024.8.12 | Graph Traversal | [무인도 μ—¬ν–‰](https://school.programmers.co.kr/learn/courses/30/lessons/154540) | [#217](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/217) |
| 63μ°¨μ‹œ | 2024.9.3 | Binary Search | [ꡬ간 λ‚˜λˆ„κΈ°2](https://www.acmicpc.net/problem/13397) | [#218](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/218) |
| 64μ°¨μ‹œ | 2024.9.8 | Binary Search | [징검닀리](https://school.programmers.co.kr/learn/courses/30/lessons/43236) | [#221](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/221) |
| 64μ°¨μ‹œ | 2024.9.8 | Binary Search | [징검닀리](https://school.programmers.co.kr/learn/courses/30/lessons/43236) | [#221](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/221) |
| 65μ°¨μ‹œ | 2024.9.11 | Greedy | [λ””νŽœμŠ€ κ²Œμž„](https://school.programmers.co.kr/learn/courses/30/lessons/142085) | [#224](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/224) |

0 comments on commit bf8edb7

Please sign in to comment.