# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9683 | maniac | Phibonacci (kriii2_P) | C++98 | 0 ms | 1088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
const long long MOD(1000000007);
typedef struct matrix{
long long d[2][2];
}Matrix;
Matrix F={1, 1, 1, 0};
Matrix m_Mul(Matrix A, Matrix B){
Matrix C;
C.d[0][0]=(A.d[0][0]*B.d[0][0]+A.d[0][1]*B.d[1][0])%MOD;
C.d[0][1]=(A.d[0][0]*B.d[1][0]+A.d[0][1]*B.d[1][1])%MOD;
C.d[1][0]=(A.d[1][0]*B.d[0][0]+A.d[1][1]*B.d[1][0])%MOD;
C.d[1][1]=(A.d[1][0]*B.d[1][0]+A.d[1][1]*B.d[1][1])%MOD;
return C;
}
Matrix m_Power(Matrix A, long long n){
if(n>1){
A=m_Power(A, n/2);
A=m_Mul(A, A);
if(n&1)
A=m_Mul(A, F);
}
return A;
}
int main(){
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |