b146. NOIP2004 1.不高兴的津津
https://zerojudge.tw/ShowProblem?problemid=b146
解題思路-Python-給我自己的筆記
1。我用list放星期一到星期天的資料(總時數)
2。迴圈跑7次,每次將合計的時數放到list中 (我用「list名.append(相加值)」)
3。判斷list中最大值是誰 max(list名),
如果最大值<=8,輸出0
否則輸出最大值所在的位置所代表的星期數字 「list名.index(max(d))+1」
----------------------
程式碼參考
#b146. NOIP2004 1.不高兴的津津
#https://zerojudge.tw/ShowProblem?problemid=b146
d=[]
for i in range(7):
a,b=map(int,input().split())
d.append(a+b)
if max(d)<=8:
print(0)
else:
print(d.index(max(d))+1)