摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2065矩阵乘法推出递推公式。View Code Matrix tmp(4,4);void get_init() { int i,j,k; for(i=0;i<4;i++) for(j=0;j<4;j++) tmp(i,j)=1; for(i=0;i<4;i++) tmp(i,i)=2, tmp(i,3-i)=0;}void solve() { int i,j,k; Matrix ans(1,4), tt=tmp; ans(0,0)=ans(0,3)=1; ans(0,... 阅读全文
posted @ 2013-04-11 21:10 zhang1107 阅读(187) 评论(0) 推荐(0) 编辑
摘要: View Code const int maxn = 22; //矩阵大小struct Matrix { int r, c; //矩阵大小 int a[maxn][maxn]; //初始化 Matrix(int r,int c):r(r), c(c) {} void reset() {memset(a,0,sizeof(a));} //重写(),方便存取 int& operator() (int i,int j) {return a[i][j];} //O(N^3) 矩阵乘法 Matrix operator*(const Matrix&B)... 阅读全文
posted @ 2013-04-11 18:26 zhang1107 阅读(219) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4973推出递推公式, 数据范围那么大, 矩阵乘法。View Code const int MM = 100011;const double eps = 1e-10;#define maxint 10000000#define mod 1000000007#define debug puts("wrong");//typedef __int64 int64;typedef long long int64;//const __int64 maxint = 10 阅读全文
posted @ 2013-04-11 18:25 zhang1107 阅读(135) 评论(0) 推荐(0) 编辑