Open kimTH65 opened 2 months ago
N = int(input())
H = list(map(int,input().split()))
answer = 0
for i in range(N):
h_sel = H[i]
if answer % 3 == 1:
if h_sel >= 2 :
h_sel -= 4
answer += 2
else :
h_sel -= 4
answer += 1
elif answer % 3 == 2:
h_sel -= 3
answer +=1
if (h_sel > 0) :
a = h_sel //5
b = h_sel % 5
answer += a * 3
if b > 3 :
b = 3
answer += b
print(answer)
日立ヴァンタラプログラミングコンテスト2024(AtCoder Beginner Contest 368)
C - Triple Attack