도키도키 간식드리미

·Algorithm/백준
도키도키 간식드리미https://www.acmicpc.net/problem/12789 문제코드현재 간식 받을 순서인 turn 을 활용차례로 stack에 쌓고, stack의 마지막 부분이 현재 받을 순서라면 popstack에 남아있는 숫자가 있다면 Sad, 없으면 Nice 출력# 도키도키 간식드리미# 12789import sysinput = sys.stdin.readlineN = int(input())num = list(map(int, input().split()))stack = []turn = 1 # 지금 간식 받는 순서for i in num: stack.append(i) while stack and stack[-1] == turn: stack.pop() turn +=..
potato_pizza
'도키도키 간식드리미' 태그의 글 목록