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 |
why wa??!!#include <stdio.h> #include <iostream.h> #include <memory.h> long int a[1001][1001],b[1001][1001],c[1001][1001]; long int ea[1001],eb[1001],eac[1001],ebc[1001]; void main() { int i,j,m,p,n; memset(ea,0,sizeof(ea)); memset(eb,0,sizeof(eb)); memset(eac,0,sizeof(eac)); memset(ebc,0,sizeof(ebc)); scanf("%d%d%d",&m,&p,&n); for(i=1;i<=m;i++){ for(j=1;j<=p;j++){ scanf("%ld",&a[i][j]); ea[j]+=a[i][j]; } } for(i=1;i<=p;i++){ for(j=1;j<=n;j++){ scanf("%ld",&b[i][j]); eb[i]+=b[i][j]; } } for(i=1;i<=m;i++){ for(j=1;j<=n;j++){ scanf("%ld",&c[i][j]); eac[i]+=c[i][j]; ebc[j]+=c[i][j]; } } //printf("test\n"); /* test : */ long int temp; int x,y; bool yes = true; for(i=1;i<=n;i++) { temp = 0; for(j=1;j<=p;j++) { temp+=ea[j]*b[j][i]; } if(temp==ebc[i]) yes = true; else {yes = false;y = i;break;} } for(i=1;i<=m;i++) { temp = 0; for(j=1;j<=p;j++) { temp+=a[i][j]*eb[j]; } if(temp==eac[i]) yes = true; else {yes = false;x = i;break;} } if(yes) { printf("Yes\n"); } else { printf("No\n"); printf("%d %d\n",x,y); temp = 0; for(i=1;i<=p;i++) { temp += a[x][i]*b[i][y]; } cout<<temp<<endl; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator