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

[소병희] - 작업, 키 순서, 구간 합 구하기 5, 도넛과 막대 그래프 #218

Merged
merged 4 commits into from
Mar 12, 2024

Conversation

bngsh
Copy link
Contributor

@bngsh bngsh commented Mar 10, 2024

📌 from issue #214 📌

📋문제 목록📋

작업: ✅
구간 합 구하기 5: ✅
키 순서: ⛔️
도넛과 막대 그래프: ⛔️

@bngsh bngsh added the 병희 label Mar 10, 2024
@bngsh bngsh self-assigned this Mar 10, 2024
Comment on lines +5 to +8
fun solve() = with(System.`in`.bufferedReader()) {
val (n, m) = readLine().split(" ").map { it.toInt() }
val table = Array(n + 1) { IntArray(n + 1) }
val sb = StringBuilder()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일부로 사이즈 하나씩 늘려서 푸는 게 👍

Comment on lines +10 to +20
repeat(n) { i ->
readLine().split(" ").forEachIndexed { j, v ->
table[i+1][j+1] = table[i+1][j] + v.toInt()
}
}

repeat(n) { i ->
repeat(n) { j ->
table[i+1][j+1] += table[i][j+1]
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 쉽게 구간합을 구할 수 있었네요..😎

Comment on lines +33 to +35
for(b in 0 until n) {
if (adj[a][b] != 0) cnt++
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앞뒤를 모두 체크하셔서 이 부분에서 저랑 차이가 있네요!
저는 [a][b] || [b][a] 이렇게 둘 다 확인이 필요했어요!

Copy link
Member

@soopeach soopeach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!!


repeat(n) { i ->
readLine().split(" ").forEachIndexed { j, v ->
table[i+1][j+1] = table[i+1][j] + v.toInt()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

내 위치에 이전 위치를 더하는 것이 아니고 다음 위치를 기준으로 연산하면 요렇게 처리가 가능하군요!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

입력 받으면서 처리하는게 깔끔하니 예쁘네요

Comment on lines +18 to +26
2 -> {
adj[a][b] = 1
adj[b][a] = -1
}

-2 -> {
adj[a][b] = -1
adj[b][a] = 1
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 요런식으로 판정을 할 수도 있군요

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 방법이 되게 신기해요


repeat(n) { i ->
readLine().split(" ").forEachIndexed { j, v ->
table[i+1][j+1] = table[i+1][j] + v.toInt()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

입력 받으면서 처리하는게 깔끔하니 예쁘네요

Comment on lines +18 to +26
2 -> {
adj[a][b] = 1
adj[b][a] = -1
}

-2 -> {
adj[a][b] = -1
adj[b][a] = 1
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 방법이 되게 신기해요

@bngsh bngsh changed the title [소병희] - 작업, 키 순서, 구간 합 구하기 5 [소병희] - 작업, 키 순서, 구간 합 구하기 5, 도넛과 막대 그래프 Mar 12, 2024
@bngsh bngsh merged commit ce368b3 into main Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants