2015年8月26日

XDUOJ 1115

摘要: 题意:已知x+y=A x*y=B 求X^n+Y^n.思路:设f(i)为X^n+Y^n 则f(n)=A*f(n-1)-B*f(n-2) 然后矩阵快速幂.在矩阵乘法过程中有负数 在取余之前要先加上MOD.#include #include #include #include #include #incl... 阅读全文

posted @ 2015-08-26 16:49 onlyAzha 阅读(174) 评论(0) 推荐(0) 编辑

矩阵快速幂模板

摘要: const ll MOD=1e9+7;const int MAXN=60; //矩阵阶数struct Matrix{ ll m[MAXN][MAXN]; Matrix() { memset(m,0,sizeof(m)); for(int i=0;i>=1... 阅读全文

posted @ 2015-08-26 16:45 onlyAzha 阅读(109) 评论(0) 推荐(0) 编辑

导航