import sysfor line in sys.stdin:a=list(map(int,line.split()))score=0for i in range(len(a)):score=score+a[i]if score>=59*a[0]:print('no')else:print('yes')
以第一題為例,你的a會是[1,60,所以你的score會多加1,還有最後的條件題目要大於不是大於等於
附上我得程式:
import sys for s in sys.stdin: a=list(map(int,s.split(" "))) x=a[0] score=0 for i in (a): score+=i if score-x>59*a[0]: print('no') else: print('yes')
import sysfor line in sys.stdin:a=list(map(int,line.split()))score=0for i in range(len(a)):score=score+a[i]if score>=59*a[0]:print('no')else:print('yes')
以第一題為例,你的a會是[1,60,所以你的score會多加1,還有最後的條件題目要大於不是大於等於附上我得程式:
import sys for s in sys.stdin: a=list(map(int,s.split(" "))) x=a[0] score=0 for i in (a): score+=i if score-x>59*a[0]: print('no') else: print('yes')
AC了
謝謝你的幫忙