-
Notifications
You must be signed in to change notification settings - Fork 0
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
[소병희] - 동전, 호텔, 멀쩡한 사각형, 택배 배송 #247
Conversation
for(i in 1 .. c * 100) { | ||
if (dp[i] >= c) { | ||
println(i) | ||
return@with | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그냥 print(dp[c])하면 안되나요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인덱스가 인원수가 아니라 가격이라서 이렇게 해줘야 했어요 흑흑
pq.add(Node(0, 0)) | ||
while(pq.isNotEmpty()) { | ||
val (i, v) = pq.poll() | ||
if (dist[i] <= v) continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 이거 하면 좀 더 빠르겠네요!
fun solution(w: Int, h: Int): Long { | ||
val gcd = gcd(w, h) | ||
val sw = w / gcd | ||
val sh = h / gcd | ||
val adj = 1 + (sw - 1) + (sh - 1) | ||
|
||
return (0L + w) * h - gcd * adj | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"가로지는 선" 풀이 잘 들었습니다!😀
class 소병희_택배배송 { | ||
companion object { | ||
data class Node(val i: Int, val v: Int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
틀렸던 부분 말씀 주셔서 좋았어요!
참고해서 풀어보겠습니다🫡
for(p in 1 .. price) { | ||
for((i, c) in coins.withIndex()) { | ||
if (p < c) continue | ||
for(pre in 0 .. i) { | ||
dp[p][i] += dp[p - c][pre] | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
설명 주셔서 감사했습니다! 출력하면서 다시금 파악해야겠어요!🫡
📌 from issue #244 📌
📋문제 목록📋