矩阵模版(例题3070、3744)
2012-05-30 21:36
225 查看
struct matrix { double A[NMax][NMax]; matrix operator*(const matrix & m) { matrix ret={0,0,0,0}; for(int i=0;i<NMax;i++) for(int k=0;k<NMax;k++) if(A[i][k]>0.0) for(int j=0;j<NMax;j++) ret.A[i][j]+=A[i][k]*m.A[k][j]; return ret; } }def={1,0,0,1}; matrix pow(matrix a,int n) { matrix tmp=a,ret=def; while(n!=0) { if((n&1)!=0) ret=ret*tmp; tmp=tmp*tmp; n>>=1; } return ret; }
相关文章推荐
- ACM日记_17.5.01——矩阵快速幂整理(例题i:Fibonacci POJ - 3070)
- hpuvj【3070】Fibonacci(矩阵快速幂求模)
- POJ 题目3744(矩阵优化概率DP)
- poj3070 Fibonacci(矩阵快速幂)
- 模版--矩阵快速幂
- poj 3070 Fibonacci(矩阵快速幂)
- POJ 3070 Fibonacci(矩阵快速幂模板)
- POJ 3744 Scout YYF I 矩阵快速幂加速dp
- 矩阵快速幂POJ-3070
- POJ 3070 Fibonacci(快速幂矩阵)
- 矩阵连乘 模版
- 矩阵快速幂 poj 3070
- poj 3070 Fibonacci(矩阵优化递推入门)
- POJ_Fibonacci POJ_3070(矩阵快速幂入门题,附上自己写的矩阵模板)
- poj 3070 矩阵快速幂
- POJ 3744 Scout YYF I 矩阵快速幂+概率dp
- poj-3744 Scout YYF I [用矩阵优化概率递推式]
- poj 3070 Fibonacci(矩阵快速幂)
- POJ 3070 Fibonacci(矩阵快速幂)
- poj 3070 Fibonacci (快速矩阵乘法)