#include<bits/stdc++.h> #define mod 1000000009 using namespace std; typedef long long ll; typedef long long LL; struct Mat { LL mat[3][3]; Mat() { memset(mat,0,sizeof(mat)); } LL* operator [](int x) //注意这种写法 { return mat[x]; } } A; Mat Mut(Mat a,Mat…
Fibonacci Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13172 Accepted: 9368 Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci seque…
E. Anniversary time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of c…
先占坑 后面再写详细的 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))…