他说:O(n^3)是过不了滴
一搜……
6
代码和题解没有实质区别:
#include<cstdio>
#include<ctime>
#include<cstdlib>
using namespace std;
int a[505][505],b[505][505],c[505][505];
int main(){
srand(time(NULL));
int n;
ios::sync_with_stdio(0);
cin.tie(0);
while(cin>>n){
for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)cin>>a[i][j];
for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)cin>>b[i][j];
for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)cin>>c[i][j];
bool f=0;
for(int t=0;t<60000;t++){
int row=rand()%n+1;
int col=rand()%n+1;
int num=0;
for(int i=1;i<=n;i++)
num=num+a[row][i]*b[i][col];
if(num!=c[row][col]){f=1;break;}
}
if(!f)printf("Yes\n");
else printf("No\n");
}
return 0;
}
标签:include,int,cin,3318,POJ,505
From: https://www.cnblogs.com/zan-mei-tai-yang/p/18395179