原理可参考:https://blog.csdn.net/qq_19782019/article/details/85621386
'''
@param base 底数
@param power 指数
@return res 求幂结果的最后3位数
'''
def fast_power(base, power):
res = 1
while power > 0:
if power % 2 == 1:
res = res * base % 1000
power = power // 2
base = base * base % 1000
return res % 1000
print(fast_power(2,1000000000))