[20250711] BOJ / G2 / 1의 개수 세기 / 이인희 #441
Merged
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.
🧷 문제 링크
https://www.acmicpc.net/problem/9527
🧭 풀이 시간
90분
👀 체감 난이도
✏️ 문제 설명
엄청 큰 수 사이의 모든 숫자를 이진수하였을때, 1의 개수를 모두 더하기
🔍 풀이 방법
2^0자리는 0101010... 2^1자리는 00110011.... 2^2자리는 0000111100001111.... 임을 이용하여서, 0, 1, 2 이렇게 while돌리며, 인풋 첫숫자가 포함된 block, 인풋 두번째 숫자가 포함된 block을 판단하여 1의 개수를 계산해나감
⏳ 회고
이런 숫자 세는거에서 너무 약하다... 그리고, 결과가 오버플로우나서 gpt한테 자료형을 맞춰달라고 도움을 요청해버렸다... 자바 자료형 공부도 하자