[20250205] BOJ / 플레4 / 시저 암호 / 신희을 #46
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/1893
🧭 풀이 시간
90 분
👀 체감 난이도
✏️ 문제 설명
알파벳 순서 A, 원문 W, 시저 암호화된 문자열 S가 있다. 암호화된 문자열 S는 특정 문자열의 문자들을 알파벳 순서에 따라 X 만큼 밀어서 만든 문자열이다. 암호화 되기 전의 문자열에 원문 W가 단 1번만 등장하는 X를 오름차순으로 출력하라.
🔍 풀이 방법
원문으로 실패 배열을 만들고, 암호화된 문자열을 하나씩 밀면서 문자열과 원문을 KMP로 단 한번만 등장하는 지를 체크한다.
⏳ 회고
KMP를 구현하는 방법이 가물가물해서, 범위 밖으로 너무 많이 튀어나갔다. 그리고 X만큼 밀어서 암호화된 문자열을 만들 수 있는 문자열에서 원문을 살펴야하는데, 암호화된 문자열에서 X만큼 민 값에 원문이 있는 지를 보고 있었다. 문제를 똑바로 읽는 습관을 들이도록 하자.