본문 바로가기
python-algorithm

[백준] 1592

by 무적김두칠 2021. 2. 19.

1
2
3
4
5
6
7
8
9
n,m,l=map(int, input().split())
game=[0]*n
cnt=0
start=0
while game[0]!=m:
    game[start]+=1
    start=(start+l)%n
    cnt+=1
print(cnt-1)
cs

반복문 이용하면 쉽습니다

특이사항으로는 line 9에서 cnt -1 하는 이유는 while 문이 예상했던것과 다르게 1번 더 반복되야 멈추기 때문입니다.

반응형

'python-algorithm' 카테고리의 다른 글

[백준] 1673  (0) 2021.02.23
[백준] 1672  (0) 2021.02.19
[백준] 1475  (0) 2021.02.19
[백준] 1373  (0) 2021.02.19
[백준] 1316  (0) 2021.02.19

댓글