-Code
for t in range(1, int(input()) + 1):
s_max, audience = input().split()
s_max = int(s_max)
cnt, res = int(audience[0]), 0
for level in range(1, s_max + 1):
if cnt < level:
res += level - cnt
cnt = level
cnt += int(audience[level])
print(f"Case #{t}: {res}")
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 5349번 Duplicate SSN (0) | 2024.06.23 |
---|---|
[백준/파이썬] 2622번 삼각형만들기 (0) | 2024.06.22 |
[백준/파이썬] 27130번 Long Multiplication (0) | 2024.06.20 |
[백준/파이썬] 31994번 강당 대관 (0) | 2024.06.19 |
[백준/파이썬] 31962번 등교 (0) | 2024.06.18 |