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

新手求救!不知为什么WA

Posted by maomao19850615 at 2007-09-24 21:11:56 on Problem 1323
#include <iostream>
#include <algorithm>
#include <string>
#include <stdlib.h>
#include <math.h>
using namespace std;

main()
{
	int card_num,person_num,card[60],count2,sum,count,i,bigcard;
	count=0;
	while(scanf("%d%d",&person_num,&card_num)&&card_num!=0&&person_num!=0)
	{
		count++;
		for(i=0;i<card_num;i++)
		{
			scanf("%d",&card[i]);
		}
		sort(card,&card[card_num]);
		sum=person_num*card_num;
		count2=0;
		for(i=card_num-1;i>0;i--)
		{
			bigcard=sum-card[i]-(card_num-i-1);
			if(bigcard<=0)
				count2++;
			else
				sum--;
		}
		printf("Case %d: %d\n",count,count2);
	}
}

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