Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大牛看看 为啥会RE?#include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <ctime> using namespace std; #define Max(a,b) (((a)>(b))?(a):(b)) #define Min(a,b) (((a)<(b))?(a):(b)) #define N 501 int n; int a[N][N],b[N][N],c[N][N]; int t[N]; int r0[N],r1[N],r2[N]; bool right; int main() { srand((unsigned)time(NULL)); while(scanf("%d",&n)!=EOF) { right=true; for(int i=0;i<n;i++) for(int j=0;j<n;j++) scanf("%d",&a[i][j]); for(int i=0;i<n;i++) for(int j=0;j<n;j++) scanf("%d",&b[i][j]); for(int i=0;i<n;i++) for(int j=0;j<n;j++) scanf("%d",&c[i][j]); for(int k=1;k<=10;k++) { for(int i=0;i<n;i++) t[i]=rand()%100; for(int i=0;i<n;i++) { r1[i]=0; r0[i]=0; for(int j=0;j<n;j++) { r1[i]+=t[j]*a[j][i]; r0[i]+=t[j]*c[j][i]; } } for(int i=0;i<n;i++) { r2[i]=0; for(int j=0;j<n;j++) r2[i]+=r1[j]*b[j][i]; } for(int i=0;i<n;i++) if(r2[i]!=r0[i]){right=false;break;} if(!right) break; } if(right) printf("YES\n"); else printf("NO\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator