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 198585 at 2007-12-24 04:36:11 on Problem 1323
#include <algorithm>
using namespace std;
bool num[1010];
int num1[110];
int main(){
	int m,n,k,count,j,s=0,count1;
	while(scanf("%d%d",&m,&n) &&(m+n))
	{
		s++;
		memset (num,false,sizeof(num));
		num[0]=true;
		for(int i=0;i<n;i++)
		{
			scanf("%d",&num1[i]);
			num[num1[i]]=true;	
		}
		sort(num1,num1+n);
		count1=0;
		for(i=0;i<n;i++)
		{
			count=0;
			k=num1[i];
			int k1=k+1;
			while(k1<=m*n)
			{
				if(num[k1]==false)
				{
					num[k1]=true;
					count++;
					count1++;
					break;
				}
				k1++;
			}
			j=0;	
			for(int p=0;p<=m*n;p++)
			{
				if(num[p]==false)
				{
					num[p]=true;
					j++;
				}
				if(j==m-1-count)
					break;
			}	
		}
		printf("Case %d: %d\n",s,n-count1);
	}
	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