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 anonym11 at 2004-08-22 20:18:44 on Problem 1581
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int p,pe;pe= 0;int i,s,tp;
	char name[100],temp[100];
	int sub[4],time[4];
	while(n--){
		s = 0;
		cin >> temp;
		for(i = 0;i< 4;i ++)
		{
			cin >> sub[i] >> time[i];
			if(time[i])s += 1;
		}
		if(s < p)
			continue;
		else
		{
			tp = 0;
			for(i = 0;i < 4;i ++)
				if(time[i])
					tp += (time[i] + 20 * (sub[i]-1));
				if(s > p)
				{
					p = s;
					pe = tp;
					strcpy(name,temp);
				}
				else
					if(pe > tp)
					{
						p = s;
						pe = tp;
						strcpy(name,temp);
					}
		}
	}
	cout << name <<' '<<p <<' ' <<pe << 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