[20251028] BOJ / G4 / 주사위 굴리기 / 이강현 #1252
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/14499
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
NxM 지도 위 특정 지점에 주사위 한개가 있음.
주사위를 상하좌우로 한칸씩 굴릴거임. 처음엔 주사위의 모든 면이 다 0임
굴린 후, 주사위의 위치에 해당하는 지도의 값이 0이면 주사위 바닥 부분의 값을 복사함.
아니라면 주사위의 바닥의 값이 지도의 값이 되고 지도의 값은 0이됨.
여러번 굴릴때마다 주사위의 윗면의 값을 출력.
지도를 벗어나는 경우에는 굴리는 행위도 출력도 하면 안됨.
🔍 풀이 방법
시뮬레이션
문제에 전개도가 주어져서 가로를 row, 세로를 col로 설정하여 state를 정의했다.
굴리는 방향에 따라 배열값을 직접 수정했다.
⏳ 회고
구현이 요즘 메타래