Description
X和Y是正整数,求X的Y次方。由于答案可能很大,我们只要输出求答案%100000007。
80分程序: (超时)
c,d=map(int,input().split())
print(c**d%100000007)
100分程序
def f(a,b):
if b==0:
return 1
if b%2==1:
return a*f(a,b-1)%100000007
else:
return f(a*a%100000007,b/2)%100000007
c,d=map(int,input().split())
print(f(c,d))
Input
第一行2个正整数:X Y。
X范围[1, 1000000];
Y范围[0, 100000000000];