注意前两项是0 1 还是 1 1
#include <iostream>
#include <string.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef unsigned long long LL;
const int M = 2;
struct Matrix
{
LL m[M][M];
};
Matrix A;
Matrix I = {1,0,0,1};
Matrix multi(Matrix a,Matrix b,LL MOD)
{
Matrix c;
for(int i=0; i<M; i++)
{
for(int j=0; j<M; j++)
{
c.m[i][j] = 0;
for(int k=0; k<M; k++)
c.m[i][j] = (c.m[i][j]%MOD + (a.m[i][k]%MOD)*(b.m[k][j]%MOD)%MOD)%MOD;
c.m[i][j] %= MOD;
}
}
return c;
}
Matrix power(Matrix a,LL k,LL MOD)
{
Matrix ans = I,p = a;
while(k)
{
if(k & 1)
{
ans = multi(ans,p,MOD);