#45163: 簡單理解


0801elmer666@gmail.com (薛冠志)

學校 : 國立霧峰高級農工職業學校
編號 : 273218
來源 : [106.107.218.192]
最後登入時間 :
2025-01-03 23:02:44
q181. 1. 等紅綠燈 -- 2025年1月APCS | From: [106.107.218.192] | 發表日期 : 2025-01-18 22:31

a, b = map(int,input().split())
num = int(input())
time = list(map(int,input().split()))
time_num = a + b
total = []
for i in range(num):
figure = time[i] % time_num
figure -= a
if figure > 0:
count = b - figure
elif figure == 0:
count = b
else:
count = 0
total.append(count)
end = 0
for i in range(num):
end += total[i]
print(end)
 
ZeroJudge Forum