diff --git "a/gjsk132/Greedy/15903 \354\271\264\353\223\234 \355\225\251\354\262\264 \353\206\200\354\235\264.py" "b/gjsk132/Greedy/15903 \354\271\264\353\223\234 \355\225\251\354\262\264 \353\206\200\354\235\264.py" new file mode 100644 index 0000000..72937bb --- /dev/null +++ "b/gjsk132/Greedy/15903 \354\271\264\353\223\234 \355\225\251\354\262\264 \353\206\200\354\235\264.py" @@ -0,0 +1,17 @@ +import heapq as hp + +input = open(0).readline + +card_cnt, merge_cnt = map(int, input().split()) + +card_num = list(map(int,input().split())) + +hp.heapify(card_num) + +for i in range(merge_cnt): + + a, b = hp.heappop(card_num), hp.heappop(card_num) + hp.heappush(card_num, a+b) + hp.heappush(card_num, a+b) + +print(sum(card_num)) \ No newline at end of file diff --git a/gjsk132/README.md b/gjsk132/README.md index ea960e5..e1ef0ba 100644 --- a/gjsk132/README.md +++ b/gjsk132/README.md @@ -23,4 +23,5 @@ | 21μ°¨μ‹œ | 2024.02.11 | DP | [3067 Coins](https://www.acmicpc.net/problem/3067) | [πŸͺ™](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/102) | | 22μ°¨μ‹œ | 2024.02.15 | Brute Froce | [1107 리λͺ¨μ»¨](https://www.acmicpc.net/problem/1107) | [πŸ“²](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/106) | | 23μ°¨μ‹œ | 2024.02.27 | Sort | [18870 μ’Œν‘œ μ••μΆ•](https://www.acmicpc.net/problem/18870) | [πŸ“Œ](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/117) | +| 24μ°¨μ‹œ | 2024.03.03 | Greedy | [15903 μΉ΄λ“œ 합체 놀이](https://www.acmicpc.net/problem/159030]) | [πŸƒ](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/122) | | 25μ°¨μ‹œ | 2024.03.05 | Perfix Sum | [21758 κΏ€ λ”°κΈ°](https://www.acmicpc.net/problem/21758) | [🍯](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/126) | \ No newline at end of file