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.
문제풀이
0번째 사람이 n번째 번호를 가진 사람을 선택하고 n번째 번호를 가진 사람은 m번째 번호를 가진 사람을 선택하고 이걸 반복하다가 입력값의 오른쪽 번호를 가진 사람이 지목받으면 몇번만에 그 사람이 선택되었는지 출력하는 문제이다
for ~ else 문
조건문에도 else를 쓸 수 있고, 파이썬에서는 반복문에도 else를 쓸 수 있습니다
출력값
위의 코드만 보면, 굳이? 싶지만 break가 등장하면 얘기가 달라집니다.
반복문에서 break를 만나지 않을 때 출력됩니다.