[백준/Python] 14720번 우유 축제

divele·2023년 9월 21일

백준

목록 보기
15/17


정답 1

n = int(input())
m = list(map(int, input().split()))
a = [0,1,2]
count = 0
ans = 0

for i in m:
    if i == a[count]: ans += 1; count += 1
    if count > 2: count = 0

print(ans)

정답 2

n = int(input())
m = list(map(int, input().split()))
ans = 0
for i in m:
    if i == ans % 3: ans += 1    
print(ans)
profile
https://solved.ac/profile/divele

0개의 댓글