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

why wa?

Posted by weisen at 2008-11-18 12:26:31 on Problem 1323
#include <iostream>
using namespace std;
int a[50];
int resultset[2000];
int main()
{
	
	int i,j=0;
	int num,t;
	int mannum,cardnum;
	cin>>mannum>>cardnum;
	while (mannum!=0&&cardnum!=0)
	{
		bool* b=new bool [cardnum];
		for (i=0;i<cardnum;i++)
		{
			b[i]=false;
		}
		int d1,d2;
		d1=mannum*cardnum;
		d2=d1-cardnum;
		for (i=0;i<cardnum;i++)
		{
			cin>>a[i];
		}

		for (i=0;i<cardnum;i++)
		{
			if (a[i]>d2)
			{
				b[d1-a[i]]=true;
			}
			
		}
		
		i=0;  num=0;  t=0;
		while(i<cardnum)
		{
			if (t>=cardnum-i)
				break;
			if (b[i])
			{
				if (t)t--;
				else num++;
				
			}
			else
				t++;
			i++;
		}
		resultset[j++]=num;
		cin>>mannum>>cardnum;
		
	}
	
	for (i=0;i<j;i++)
	{
		cout<<"Case "<<i+1<<": "<<resultset[i]<<endl;
	}
	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