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 q7f4f4 at 2010-08-28 12:59:16 on Problem 1323
	while(scanf("%d%d",&m,&n))
	{
		if(m==0&&n==0) break;
		ans=0;
		time++;
		memset(flag,1,sizeof(flag));
		for(i=1;i<=n;i++)
		{
			scanf("%d",&T[i]);
			flag[T[i]]=false;
		}		
		sort(T+1,T+n+1);
		for(i=n;i>0;i--)
		{
			flag[T[i]]=false;
			for(k=T[i]+1;k<=m*n;k++)
				if(flag[k]==true)
				{
					flag[k]=false;
					break;
				}
			if(k>m*n) ans++;
		}
		printf("Case %d: %d\n",time,ans);
	}

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