Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 예제 입력
4 4
9 14 29 7
1 31 6 13
21 26 40 16
8 38 11 23
3
1 1 3 2
1 1 1 4
1 1 4 4
💡 Solution
9 14 29 7 → 9 14 29 7
1 31 6 13 → 10 45 35 20
21 26 40 16 → 31 71 75 36
8 38 11 23 → 39 109 86 59
열별로 합을 누적시킨다. 마지막 줄의 39가 첫 열의 합, 109는 둘째 열의 합, 59는 넷째열의 합이 된다
1 1 3 2 (입력) → 102 (출력)
1 1 1 4 (입력) → 59 (출력)
2 2 3 4 (입력) → 132 (출력)
3 2 4 4 (입력) → 154 (출력)
x1 > 1인경우, 2 2 3 4 를 입력했을 때는 구역이 중간에서 시작한다.
가장 아랫줄의 합에서 시작지점인 2행보다 한 줄위인 1행의 합을 빼줘야 정답이 된다.