标签:
struct Matrix { int n , m , a[2][2]; Matrix (int _n = 0, int _m = 0) { n = _n , m = _m; memset(a , 0 , sizeof(a)); } Matrix operator * (const Matrix &R) const { Matrix res(n , R.m); for (int i = 0 ; i < n ; ++ i) { for (int j = 0 ; j < m ; ++ j) { for (int k = 0 ; k < R.m ; ++ k) { res.a[i][k] += (LL)a[i][j] * R.a[j][k] % Q; res.a[i][k] %= Q; } } } return res; } };
标签:
原文地址:http://www.cnblogs.com/Kurokey/p/5635703.html