Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Week2] 강동호: 가장 큰 수, ATM, 이건 꼭 풀어야 해!, 줄 세우기, H-index #9

Merged
merged 10 commits into from
May 28, 2022
17 changes: 17 additions & 0 deletions src/2week/dongho/ATM.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package `2week`.dongho

import java.io.*
import java.util.*

fun main() {
val br = BufferedReader(InputStreamReader(System.`in`))
br.readLine()
val pq = PriorityQueue(br.readLine().split(" ").map { it.toInt() }.toList())
gongdongho12 marked this conversation as resolved.
Show resolved Hide resolved
var temp = 0
var answer = 0
while (!pq.isEmpty()) {
temp += pq.poll()
answer += temp
}
println(answer)
}