无法解决Python中关于codechef的NZEC错误,尽管它在IDE上提供了正确的输出

k4ymrczo  于 2023-02-01  发布在  Python
关注(0)|答案(1)|浏览(87)
def gcd(x,y):
    while(x!=y):
        if(y != 0):
            return(gcd(y,x%y))
        else:
            return(x)
t = input()
while (t>0):
    t = t-1
    a,b,n = raw_input().split(" ")
    a=int(a)
    b=int(b)
    n=int(n)
    x = pow(a,n) + pow(b,n)
    y = a-b
    print(gcd(x,y))

在这里我得到了NZEC(运行时)错误的codechef,但如果我写测试用例manually然后它是工作得很好,所以请帮助...

zyfwsgd6

zyfwsgd61#

对于python 3
1.将t变量转换为int

t=int(t)

1.将raw_input()更改为input()
如果没有,请注解该行。

相关问题