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 shengye_205 at 2007-05-16 16:23:32 on Problem 2419
#include<iostream.h>
void main()
{
	int m,n,c=0,j;
	cin>>m>>n;
	int a[102][102];
	for(int i=0;i<102;i++)
		for(j=0;j<102;j++)
			a[i][j]=0;
		while(cin>>i>>j)
		{
			int k=0;
			while((a[i-1][k]!=j)&&(a[i-1][k]!=0))
				k++;
			if(a[i-1][k]==0)
			{
				a[i-1][k]=j;
				a[i-1][101]++;
			}
		}
		
		int l;
		for(i=0;i<m;i++)
		{
			
			for(l=1;l<a[i][101];l++)
			{
				int x=a[i][l];
				for(j=l-1;j>=0;j--)
					if(x<a[i][j])
						a[i][j+1]=a[i][j];
					else 
						break;
					a[i][j+1]=x;
					
			}
		}
		
		for(i=0;i<m;i++)
			for(j=i+1;j<m;j++)
				if(a[i][101]==a[j][101])
				{
					for(l=0;l<a[i][101];l++)
						if(a[i][l]!=a[j][l])
							break;
						if(l==a[i][101])
						{
							a[i][100]=a[j][100]=1;
							c++;
						}
				}
		cout<<m-c<<endl;
}

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