#30485: Python 我還是不懂為什麼輸出0


s913043@gm.hccvs.hc.edu.tw (資三2-10黃玄燁)


我其他測資都過了 永遠就只有這個輸出0行

到底???

while 1:
    try:
        ans = pow(3, int(input()))
        if ans > 10006:
            print(ans % 10007)
       
        else:
            print(ans)
    except:
        break
#30486: Re: Python 我還是不懂為什麼輸出0


cges30901 (cges30901)


我其他測資都過了 永遠就只有這個輸出0行

到底???

while 1:
    try:
        ans = pow(3, int(input()))
        if ans > 10006:
            print(ans % 10007)
       
        else:
            print(ans)
    except:
        break

 

您的程式被監控系統中斷,可能是程式無法正常結束所導致。
Traceback (most recent call last):
  File "/9680228/code_9680228.py", line 3, in 
    ans = pow(3, int(input()))
MemoryError

不能直接算