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 zeng at 2008-05-28 17:42:10 on Problem 3117
#include<iostream>
#include<algorithm>
using namespace std;
char team[210][20];
int score[210];

int cmp(int a, int b)
{
	return a>b;
}

int main()
{
	int T, N, num,i;
	while(1)
	{
		scanf("%d%d", &T, &N);
		if(!T)	break;
		for(i=0;i<T;i++)
		{
			scanf("%s", team[i]);
			scanf("%d", &score[i]);
		}
		sort(score, score+T, cmp);
		num=0;
		for(i=0;i<T;i++)
		{
			if(score[i]<3)
				break;
			num+=score[i]/3;		
		}
		printf("%d\n", N-num);

	}
	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