개발/Algorithm
[Python] 백준 14720번 우유 축제
Dane.Kim
2021. 11. 15. 22:22
n = int(input())
store = list(map(int,input().split()))
cnt = 0
for i in range(n):
if store[i] == cnt % 3:
cnt += 1
print(cnt)
같이 문제를 풀었던 친구는 아래와 같은 식으로 풀었다.
input()
store = list(input().split())
cnt = 0
milk_state = 0
for i in store:
if int(i) == milk_state:
milk_state += 1
cnt += 1
if milk_state > 2:
milk_state = 0
print(cnt)