Brief description :
矩阵乘。。。
/*
Author : xiaodao
Prob : HOJ 2969. Sanguosha and Card
Status: Accepted
*/
#include
using namespace std;
const int N = 100;
const int M = 20092009;
class Matrix {
friend Matrix operator +(const Matrix& , const Matrix&);
friend Matrix operator *(const Matrix& , const Matrix&);
public:
int d[N][N];
Matrix(){memset(d, 0, sizeof(d));};
Matrix& operator *=(const Matrix&);
void unify();
};
class Vector {
friend Vector operator *(const Vector& , const Matrix&);
public:
int d[N];
Vector(){memset(d, 0, sizeof(d));};
Vector& operator *=(const Matrix&);
void unify();
};
int n, m, k, q;
void Matrix::unify(){
for (int i=0;i>=1;
}
return c;
}
Vector operator *(const Vector& a, const Matrix& b) {
Vector c;
for(int i=0;i
Background :
八姐的程序应该也是对的,我按照他的想法重写了一遍,各种重载运算符是我的习惯,
至于之前的程序为什么错,我想是快速幂时爆栈所致。