#41514: python


yan1008 (yan)

學校 : 不指定學校
編號 : 276008
來源 : [123.194.206.207]
最後登入時間 :
2024-10-20 00:53:13
j352. 開心農場 (Farm) -- TOI練習賽202211新手組第1題 | From: [123.194.206.207] | 發表日期 : 2024-08-03 01:30

n = int(input())
rain = [int(x) for x in input().split()]
sun = [int(x) for x in input().split()]
x, y = map(int, input().split())
r = 0      # 目前累積的雨量與日照時速
s = 0
week = 0   # 記錄到第幾周

for i in zip(rain, sun):
    r += i[0]
    s += i[1]
    week += 1
    if r >= x and s >= y:
        print(week + 1)
        break
if r < x or s < y:
    print('-1')




 
ZeroJudge Forum