第0個 test TLE killed 誰來幫我看看,求救
import sys
for line in sys.stdin: count = 0 if not line or line == "\n" or line == "": break theList = line.strip().split() theList = list(map(int, theList)) if theList[1] > 0 and theList[1] < theList[0]: break if theList[1] < 0 and theList[0] < theList[1]: break while True: count += 1 theList[0] += theList[0] + count if theList[0] > theList[1]: print(count+1) break
第0個 test TLE killed 誰來幫我看看,求救
import sys
for line in sys.stdin:count = 0if not line or line == "\n" or line == "":breaktheList = line.strip().split()theList = list(map(int, theList))if theList[1] > 0 and theList[1] < theList[0]:breakif theList[1] < 0 and theList[0] < theList[1]:breakwhile True:count += 1theList[0] += theList[0] + countif theList[0] > theList[1]:print(count+1)breakwhile True裡面的the list[0]是不斷更改的,如果n<=-2且m>0,就會TLE
可以試試看print(the list)就知道了