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然后它是工作得很好,所以请帮助...
1条答案
按热度按时间zyfwsgd61#
对于python 3
1.将
t
变量转换为int
1.将
raw_input()
更改为input()
。如果没有,请注解该行。