(SW) Queue - 암호생성기

광어회깍뚝썰기·2021년 8월 17일
0

swea-intermediate

목록 보기
46/51
from collections import deque

for tc in range(1,10+1):
    t=int(input())
    arr=deque(map(int,input().split()))
    
    while True:
        if arr[-1]==0:
                break
            
        for i in range(1,5+1):
            pop=arr.popleft()
            pop-=i
            arr.append(pop)
            if arr[-1]<=0:
                arr[-1]=0
                break
    
    print(f'#{t}', end=" ")
    print(*arr)      

0개의 댓글

관련 채용 정보