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

直接定义数组sub和time的大小,相当于默认数据是4个队伍,但题目给的数组不是n个队伍嘛

Posted by 202031222016 at 2023-02-27 15:38:04 on Problem 1581
In Reply To:好水啊 Posted by:KatrineYang at 2016-11-10 10:17:22
> #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