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 KatrineYang at 2016-11-10 10:17:22 on Problem 1581
#include <iostream>
#include <string>
using namespace std;

int main() {
	int n;
	cin >> n;
	int solved = -1, ppoints = 2147483647;
	string name = "";
	while(n--){
		string tname;
		int sub[4], time[4];
		cin >> tname;
		for(int i = 0; i < 4; i++) cin >> sub[i] >> time[i];
		int tsolved = 0, tpoints = 0;
		for(int i = 0; i < 4; i++){
			if(!time[i]) continue;
			tsolved++;
			tpoints += (time[i] + 20 * (sub[i]-1));
		}
		if(tsolved > solved || (tsolved==solved && tpoints < ppoints)){
			name = tname;
			solved = tsolved;
			ppoints = tpoints;
		}
	}
	cout << name << " " << solved << " " << ppoints << 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