백준 20224번: Count Up 2020 #Python

ColorlessDia·2024년 5월 20일

algorithm/baekjoon

목록 보기
182/807
import sys

while True:
    n = int(sys.stdin.readline())

    if n == 0:
        break

    d = sys.stdin.readline().split()

    count = 0

    for i in range(0, len(d) - 3):
        if int(''.join(d[i:i + 4])) == 2020:
            count += 1
    
    print(count)

0개의 댓글