尽管它在IDE上提供了正确的输出,但无法在Codechef上解决NZEC错误(使用Python)

时间:2018-08-11 12:05:22

标签: python python-3.x exception

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))

在这里,我在codechef中遇到NZEC(运行时)错误,但是如果我手动编写测试用例,则可以正常工作,所以请帮助...

1 个答案:

答案 0 :(得分:0)

对于python 3

将t变量转换为int t = int(t)。

将raw_input()更改为input()。

如果没有,请注释“在此处输入代码”行。