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

我运行的挺对的啊?为什么会wa呢?哪位牛人帮忙看看吧……谢谢啦……

Posted by 19891215 at 2009-03-06 20:42:08 on Problem 2864
#include <iostream>
using namespace std;

int main()
{
	int a[501][501];
	int i,j,n,d,flag[501],k;
	while (1)
	{
		memset(flag,0,501*sizeof(int));
		
	cin>>n>>d;
	if (n==0&&d==0)
		break;
	else
      for (i=0;i<d;i++)
	  {
		  for (j=0;j<n;j++)
			  cin>>a[i][j];
	  }
	  for (j=0;j<n;j++)
	  {
		  
			  for (k=1;k<d;k++)
			  {
			  if (a[0][j]==a[k][j]&&a[0][j]!=0)
				  flag[j]+=1;
			  else
				  flag[j]+=0;
			  }
		  
	  }
	 for (j=0;j<n;j++)
	 {
		 if (flag[j]==(d-1))
		 {
			  cout<<"yes"<<endl;
		 break;
		 }
		 else if(j!=(n-1))
			 continue;
		 else
		 cout<<"no"<<endl;
	 }
	   
	}
	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