import sys for line in sys.stdin: frm, to = map(int, line.split()) res = 0 for i in range(frm, to+1): if i == 1: continue if i == 2: res += 1 continue try: for j in range(2, i): if j*j > i: break if i % j == 0: raise Exception() except: pass else: res += 1 print(res)
請問以上CODE還能怎麼再增進效率?
這樣一直TLE 9S 但我看跟板上C解答解法差不多