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 vince4053040 at 2009-12-14 16:01:00 on Problem 1274
#include<iostream>
using namespace std;
int mark[202]={0};
int visit[202];
int cow,stall,num;
int a[202][202]={0};
int i=0,j=0,x;
int t;        //用于存cow;


void Try(int i)
{
	int pp=0;
	int sum=0;
	int e[202]={0};
	for(j=0;j<stall;j++) //厩
	{
		if((j==stall-1)&&(a[i][stall-1]==0)&&(i<cow-1))
		{
			Try(i+1);
		}
		else
		{
			if((a[i][j]>0)&&(mark[j]==0))
			{
				visit[i]=j; //把厩给羊
				mark[j]=1; //记录厩已分
				sum++;
				if(i==cow-1)
				{
					//e[pp]=sum;	
					//pp++;
					cout<<sum<<endl;
				}
				else
					Try(i+1);
			}
		}
		visit[i]=-1;
		mark[j]=0;
	}
	//cout<<pp<<" ";
	//return pp;
	for(pp=0;e[pp]!=0;pp++)
	{
		//cout<<e[pp]<<" ";
	}
}



int main()
{

	cin>>cow>>stall;
	t=cow;
	while(t--)//t=cow
	{
		cin>>num;
		while(num--)
		{
			cin>>x;
			a[i][x-1]=1;
		}
		i++;
	}
	/*for(i=0;i<cow;i++)
	{
		for(j=0;j<stall;j++)
		{
			cout<<a[i][j]<<" ";//每个羊厩为原来的-1 ;
		}
		cout<<endl;
	}*/
	
	
	
	Try(0);

 
	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