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 swust20051578 at 2007-10-25 20:16:57 on Problem 3138
#include <iostream>
#include <algorithm>
using namespace std;

struct School
{
	int num;
	int wf;
	int pc;
};

struct Team
{
	int school;
	int question;
};

School sc[102];
Team team[2000];
int sd[102];

int main()
{
	int s,t,m,i,sum,j = 1;
	while(scanf("%d%d%d",&s,&t,&m))
	{
		if(s==0&&t==0&&m==0)
			break;
		for(i=0; i<2000; i++)
		{
			team[i].school = 0;
			team[i].question = 0;
		}
		for(i=0; i<102; i++)
		{
			sc[i].num = 0;
			sc[i].wf = 0;
			sc[i].pc = 0;
			sd[i] = 0;
		}
		sum = 0;
		for(i=0; i<s; i++)
		{
			scanf("%d%d%d", &sc[i].num, &sc[i].wf, &sc[i].pc);
		}
		for(i=0; i<t; i++)
		{
			scanf("%d%d", &team[i].school, &team[i].question);
		}
		for(i=0; i<s; i++)
		{
			if(sc[i].wf)
			{
				sd[sc[i].num]++;
				sum++;
			}
			if(sc[i].pc)
			{
				sd[sc[i].num]++;
				sum++;
			}
		}
		for(i=0; i<t; i++)
		{
			if(team[i].question>=m)
			{
				if(sd[team[i].school]<3)
				{
					sd[team[i].school]++;
					sum++;
				}
			}		
		}
		printf("Case %d: %d\n",j++,sum);
	}
	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