#38425: (python)NA(0%) 求大神抓錯


f0910349038@gmail.com (馬鯊拉基)

學校 : 不指定學校
編號 : 256586
來源 : [140.115.50.48]
最後登入時間 :
2024-03-29 15:56:51
a271. 彩色蘿蔔 -- 兔子 | From: [42.73.172.84] | 發表日期 : 2023-11-22 00:59

N=int(input())
for i in range(N):
    weight_lst=input().split(" ")
    weight=int(weight_lst[5])
    day_lst=input().split(" ")
    health=0
    life=True
    if day_lst==[]:
        print(weight_lst[5])
        continue
    for j in day_lst:
        weight-=(health*int(weight_lst[4]))
        if j =="0":
            continue
        elif j=="1":
            weight+=int(weight_lst[0])
        elif j=="2":
            weight+=int(weight_lst[1])
        elif j=="3":
            weight-=int(weight_lst[2])
        elif j=="4":
            weight-=int(weight_lst[3])
            health+=1
        if weight<=0:
            life=False
            break
    if life:
        print(str(weight)+"g")
    else:
        print("bye~Rabbit")
 
題目下方的側資我能算出1g,單獨檢查也沒發現問題....
 
ZeroJudge Forum