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

Re:改后的代码...

Posted by mayp at 2007-03-16 14:14:12 on Problem 1581
In Reply To:不明白,大虾帮忙!!!! Posted by:anonym11 at 2004-08-22 20:18:44
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int p=0,pe= 0;
    int i,s,tp;
	char name[100],temp[100];
	int sub[4],time[4];
	while(n--){
		cin >> temp;
        tp = 0;s = 0;
		for(i = 0;i< 4;i ++)
		{
			cin >> sub[i] >> time[i];
			if(time[i]){s += 1;tp += (time[i] + 20 * (sub[i]-1));}
		}
		if(s < p)
			continue;
		else
		{
				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