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

why wa? for help !many thanks!!!

Posted by 444444 at 2006-07-01 14:10:22 on Problem 2419
#include<iostream>
using namespace std;
int main()
{
	bool flag[100][100];
	int i,j,t,p,a,b,k,number[100],sum=0;
	cin>>p>>t;
	memset(flag,0,sizeof(flag));
	memset(number,0,sizeof(number));
	while(cin>>a>>b)
		if(flag[a][b]==0)
		{
			number[a]++;
		    flag[a][b]=1;
		}
	bool h;
	for(i=1;i<=p;i++)
		for(j=i+1;j<=p;j++)
		{
			h=0;
			if(number[i]==number[j])
			{
				for(k=1;k<=t;k++)
				{
					if(flag[i][k]!=flag[j][k])
					{
						h=1;
						break;
					}
				}
			    if(h==0)
				    sum++;
			}
		}
	cout<<p*(p-1)/2-sum<<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