#39509: python 不使用if 的方法


henry0985524680@gmail.com (張弘勳)

學校 : 臺北市立建國高級中學
編號 : 192343
來源 : [39.12.96.63]
最後登入時間 :
2024-02-15 23:27:48
a053. Sagit's 計分程式 -- Sagit's 教學題 | From: [111.243.78.47] | 發表日期 : 2024-03-01 16:46

def solution(n):
    score=0
    plusindex=0
    plusmethods=[6,2,1,1]
    while n!=0 and score!=100:
        score+=plusmethods[plusindex//10]
        plusindex+=1
        n-=1
    print(score)
while True:
    try:
        solution(int(input()))
    except:
        break
 
ZeroJudge Forum