不明白可以去看Matrix大神的矩阵的十种应用去
code:
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 31;
int city_num,city[MAXN];
struct Mat
{
int mat[MAXN][MAXN];
}A,E;
Mat operator+ (Mat a,Mat b)
{
Mat res;
int i,j;
for (i=1;i<=city_num;i++)
{
for(j=1;j<=city_num;j++)
res.mat[i][j] = ( a.mat[i][j] + b.mat[i][j] )%2008 ;
}
return res;
}
Mat operator* (Mat a,Mat b)
{
int i,j,k;
Mat res;
for (i=1;i<......
阅读全文