斐波那契数列 前置:m_qpow C++复制#define flc_INF LLONG_MAX int fib(int x,int p=flc_INF){ if(x==0)return 0; if(x<=2)return 1; vector<vector<int> >v={{1,1},{1,0}},V={{1,1}}; v=m_cheng(V,m_qpow(v,x-2,p),p); return v[0][0]%p; } 学习资料 点此返回喵 ~