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,單獨檢查也沒發現問題....