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(运行时)错误,但是如果我手动编写测试用例,则可以正常工作,所以请帮助...
答案 0 :(得分:0)
对于python 3
将t变量转换为int t = int(t)。
将raw_input()更改为input()。
如果没有,请注释“在此处输入代码”行。