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

请问这个程序错在什么地方?

Posted by hhuu at 2007-01-02 21:19:13 on Problem 2419
#include <iostream>
using namespace std;

int main(){	
	int n[100][100]={0};
	int tn,pn,i,j;
	cin>>pn>>tn;
	while(cin>>i>>j)
	{
		cin.clear();
		n[i-1][j-1]=1;
	}	
	int *hash = new int[pn];
	for ( int y=0;y<pn;y++)
	{
		hash[y]=0;
		for ( int x=0;x<tn;x++)
			hash[y] += (x+1)*n[y][x];
	}
	int rr = 0;
	for ( int z=0;z<pn;z++)
	{	int flag = 1;
		for( int mm = 0;mm<z;mm++)
		{
			if( hash[mm]==hash[z])				
			{	
				flag = 0;
				for( int c=0;c<tn;c++)
				{
					if( n[z][c] != n[mm][c])
					{
						flag =1; break;
					}
				}				
			}
		}
		if ( flag ==1)
			rr++;
	}
	delete []hash;

	cout<<rr;
	
	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