ABC116 C - Grand Garden
https://atcoder.jp/contests/abc116/tasks/abc116_c
提出
code:python
n = int(input())
h = list(map(int, input().split()))
ans = 0
for i in range(n):
hi -= 1
解答
code: python
n = int(input())
h = list(map(int, input().split()))
ans = 0
while(True):
if (max(h) == 0):
break
i = 0
while (i < n):
if (hi == 0):
i += 1
else:
# 区間の始まり
ans += 1
while (i < n and hi > 0):
hi -= 1
# 区間の終わりまで一気に
i += 1
print(ans)
メモ
AtCoder ABC 116 C - Grand Garden (茶色, 300 点)