求求卢工的各位大佬
我是个全WA的小萌新
但是就是看不出错误;
求求各位路过的大佬帮帮忙。
#include <bits/stdc++.h>
using namespace std;
static long long MOD = pow(10,9) + 7;
long long n;
struct matrake{
long long A[101][101];
matrake(){
memset(A,0,sizeof(A));
}
};
struct matrake time_up(struct matrake one,struct matrake two){
struct matrake ans;
for (int i = 0;i<n;i++){
for (int j = 0;j<n;j++){
for (int x = 0;x<n;x++){
ans.A[i][j] = (ans.A[i][j] + ((one.A[i][x] * two.A[j][x]) % MOD)) % MOD;
//cout << one.A[i][x] << " " << two.A[x][j] << " x:" << i << " y" << j << endl;
}
//cout << ans.A[i][j] << " ";
}
//cout << endl;
}
//cout << endl;
return ans;
}
int main(){
long long k;
cin >> n >> k;
struct matrake temp;
struct matrake ans;
for (int i = 0;i<n;i++){
for (int j = 0;j<n;j++){
scanf("%lld",&temp.A[i][j]);
ans.A[i][j] = temp.A[i][j];
}
}
k --;
while (k){
//cout << k << endl;
if (k & 1){
ans = time_up(ans,temp);
//cout << "yes" << endl << endl;
}
temp = time_up(temp,temp);
k >>= 1;
}
for (int i = 0;i<n;i++){
for (int j = 0;j<n;j++){
cout << ans.A[i][j] << " ";
}
cout << endl;
}
}