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

Hi,大牛好啊~~~

Posted by Sempr at 2006-11-05 14:11:38 on Problem 3018
In Reply To:RE!!!help!!! Posted by:shenfangyi at 2006-11-05 14:10:04
> #include<stdio.h>
> #include<algorithm>
> using namespace std;
> int x[501][1000],*y[501],d,b[501];
> bool cmp(int *a,int *b)
> {
> 	int i=0;
> 	for(;i<d;i++)if(a[i]<=b[i])break;
> 	if(i<d)return true;
> 	return false;
> }
> int main()
> {
> 	int n;
> 	while(scanf("%d%d",&n,&d)!=EOF)
> 	{
> 		for(int i=0;i<=n;i++)
> 		{
> 			for(int j=0;j<d;j++)scanf("%d",x[i]+j);
> 			sort(x[i],x[i]+d);
> 			y[i]=x[i];
> 		}
> 		sort(y+1,y+n+1,cmp);
> 		memset(b,0,sizeof(b));
> 		int m=0;
> 		for(int i=1;i<=n;i++)if(cmp(y[i],x[0])==false)
> 		{
> 			b[i]=1;
> 			for(int j=1;j<i;j++)if((b[j]+1>b[i])&&(cmp(y[i],y[j])==false))b[i]=b[j]+1;
> 			if(m<b[i])m=b[i];
> 		}
> 		if(m)printf("%d\n",m);
> 		else puts("Please look for another gift shop!");
> 	}
> }

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