#21870: python 測試執行過了,但送出後第一題第一筆就錯了QAQ


10811124@stu.cmsh.khc.edu.tw (立峰陳)

學校 : 國立旗美高級中學
編號 : 108792
來源 : [27.240.168.65]
最後登入時間 :
2023-03-17 00:06:48
a271. 彩色蘿蔔 -- 兔子 | From: [114.38.245.184] | 發表日期 : 2020-07-28 15:51

a=int(input())
for i in range(a):
    b=input().split(' ')
    b=[int(i) for i in b]
    try:
        sum=b[-1]
        p=0
        c=input()
        c=c.split(' ')
        c=[int(i) for i in c]
        for i in range(len(c)):
            sum-=p*b[4]
            if sum<=0:
                print('bye~Rabbit')
                break
            if c[i]==0:
                continue
            elif c[i]==1:
                sum+=b[0]
            elif c[i]==2:
                sum+=b[1]
            elif c[i]==3:
                sum-=b[2]
            else:
                sum-=b[3]
                p=p+1
        if sum>0:
            print(str(sum)+'g')
    except:
        print(str(b[-1])+'g')
        continue
 
#21886: Re:python 測試執行過了,但送出後第一題第一筆就錯了QAQ


753951852456 (精神小伙不請自來)

學校 : 臺北市私立延平高級中學
編號 : 103367
來源 : [203.72.178.3]
最後登入時間 :
2022-04-13 12:40:32
a271. 彩色蘿蔔 -- 兔子 | From: [203.72.178.1] | 發表日期 : 2020-07-29 13:05

a=int(input())
for i in range(a):
    b=input().split(' ')
    b=[int(i) for i in b]
    try:
        sum=b[-1]
        p=0
        c=input()
        c=c.split(' ')
        c=[int(i) for i in c]
        for i in range(len(c)):
            sum-=p*b[4]
            if sum<=0:
                print('bye~Rabbit')
                break
            if c[i]==0:
                continue
            elif c[i]==1:
                sum+=b[0]
            elif c[i]==2:
                sum+=b[1]
            elif c[i]==3:
                sum-=b[2]
            else:
                sum-=b[3]
                p=p+1
        if sum>0:
            print(str(sum)+'g')
    except:
        print(str(b[-1])+'g')
        continue


簡單

 
ZeroJudge Forum