Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:wa了,能否帮忙看下

Posted by singlelove at 2007-04-05 10:41:49 on Problem 3213
In Reply To:wa了,能否帮忙看下 Posted by:zehzxm at 2007-04-02 09:28:05
> #include <iostream>
> #include <string>
> using namespace std;
> 
> int n[1001][1001],m[1001][1001],p[1001][1001];
> int ec[1001],eab[1001],cf[1001],abf[1001];
> 
> int main()
> {
> 	int a,b,c,i,j,k,o,q;
> 	while(scanf("%d%d%d",&a,&b,&c)!=EOF){
> 		memset(ec,0,sizeof(ec));
> 		memset(eab,0,sizeof(eab));
> 		memset(cf,0,sizeof(cf));
> 		memset(abf,0,sizeof(abf));
> 		for(i=0;i<a;i++)
> 			for(j=0;j<b;j++)
> 				scanf("%d",&n[i][j]);
> 		for(i=0;i<b;i++)
> 			for(j=0;j<c;j++)
> 				scanf("%d",&p[i][j]);
> 		for(i=0;i<a;i++)
> 			for(j=0;j<c;j++)
> 				scanf("%d",&m[i][j]);
> 		//计算EAB,EC
> 		for(i=0;i<b;i++)
> 			for(j=0;j<a;j++)
> 				eab[i]+=n[j][i];
> 		for(i=0;i<c;i++)
> 		{
> 			int sum=0;
> 			for(j=0;j<b;j++)
> 				sum+=eab[j]*p[j][i];
> 			eab[i]=sum;
> 		}
> 		for(i=0;i<c;i++)
> 			for(j=0;j<a;j++)
> 				ec[i]+=m[j][i];
> 		//计算ABF,CF
> 		for(i=0;i<b;i++)
> 			for(j=0;j<c;j++)
> 				abf[i]+=p[i][j];
> 		for(i=0;i<a;i++){
> 			int sum=0;
> 			for(j=0;j<b;j++)
> 				sum+=n[i][j]*abf[j];
> 			abf[i]=sum;
> 		}
> 		for(i=0;i<a;i++)
> 			for(j=0;j<c;j++)
> 				cf[i]+=m[i][j];
> 		/*
> 		for(i=0;i<a;i++)
> 			printf("%d %d\n",cf[i],abf[i]);
> 		for(i=0;i<c;i++)
> 			printf("%d %d\n",ec[i],eab[i]);
> 		*/
> 		//比较
> 		for(i=0;i<a;i++)
> 			if(abf[i]!=cf[i]){
> 				o=i;
> 				break;
> 			}
> 		for(j=0;j<c;j++)
> 			if(eab[j]!=ec[j]){
> 				q=j;
> 				break;
> 			}
> 		if(i==a && j==c) printf("Yes\n");
> 		else{
> 			int sum=0;
> 			for(i=0;i<b;i++) sum+=n[o][i]*p[i][q];
> 			printf("No\n");
> 			printf("%d %d\n",o+1,q+1);
> 			printf("%d\n",sum);
> 		}
> 	}
> 	return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator