先占坑 后面再写详细的
import numpy as np def pow(n): a = np.array([[1,0],[0,1]]) b = np.array([[1,1],[1,0]]) n -= 1 while(n > 0): if (n % 2 == 1): a = np.dot(b, a) b = np.dot(b, b) n >>= 1 return a[0][0] n = int(input()) print(factorial(n))
原文:https://www.cnblogs.com/qq965921539/p/10770912.html