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 tiaoer at 2012-03-10 22:20:59 on Problem 1323
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int i,j,list[2001],data[2001],number,flag,p,n,m,t,zong;
	for(zong=1;;zong++)
	{
		number=0;
		scanf("%d %d",&n,&m);
		if(n!=0||m!=0)
		{
		for(i=1;i<=n*m;i++)
		{
			list[i]=i;
		}
		for(i=0;i<m;i++)
		{
			scanf("%d",&data[i]);
			list[data[i]]=0;
		}
		for(i=0;i<m-1;i++)
		{
			for(j=0;j<m-i-1;j++)
			{
				if(data[j]<data[j+1])
				{
					t=data[j];
					data[j]=data[j+1];
					data[j+1]=t;
				}
			}
		}
		
		for(i=0;i<m;i++)
		{
			
			flag=0;
			for(j=0;j<=n*m;j++)
			{
				if(list[j]>data[i])
				{
					list[j]=0;
					flag=1;
					break;
				}
			}
			if(flag==0)
			{
				number++;
			}
		}
		printf("Case %d: %d\n",zong,number);
		}
		else
		{
			break;
		}

	}
	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