POJ1581 HDU1304 ZOJ1764 UVALive2832 A Contesting Decision【最值】
2018-02-08 07:47
495 查看
A Contesting Decision
Description
Judging a programming contest is hard work, with demanding contestants, tedious decisions,and monotonous work. Not to mention the nutritional problems of spending 12 hours with only donuts, pizza, and soda for food. Still, it can be a lot of fun.
Software that automates the judging process is a great help, but the notorious unreliability of some contest software makes people wish that something better were available. You are part of a group trying to develop better, open source, contest management software, based on the principle of modular design.
Your component is to be used for calculating the scores of programming contest teams and determining a winner. You will be given the results from several teams and must determine the winner.
Scoring
There are two components to a team's score. The first is the number of problems solved. The second is penalty points, which reflects the amount of time and incorrect submissions made before the problem is solved. For each problem solved correctly, penalty points are charged equal to the time at which the problem was solved plus 20 minutes for each incorrect submission. No penalty points are added for problems that are never solved.
So if a team solved problem one on their second submission at twenty minutes, they are charged 40 penalty points. If they submit problem 2 three times, but do not solve it, they are charged no penalty points. If they submit problem 3 once and solve it at 120 minutes, they are charged 120 penalty points. Their total score is two problems solved with 160 penalty points.
The winner is the team that solves the most problems. If teams tie for solving the most problems,then the winner is the team with the fewest penalty points.InputFor the programming contest your program is judging, there are four problems. You are guaranteed that the input will not result in a tie between teams after counting penalty points.
Line 1 < nTeams >
Line 2 - n+1 < Name > < p1Sub > < p1Time > < p2Sub > < p2Time > ... < p4Time >
The first element on the line is the team name, which contains no whitespace.Following that, for each of the four problems, is the number of times the team submitted a run for that problem and the time at which it was solved correctly (both integers). If a team did not solve a problem, the time will be zero. The number of submissions will be at least one if the problem was solved.OutputThe output consists of a single line listing the name of the team that won, the number of problems they solved, and their penalty points.Sample Input4
Stars 2 20 5 0 4 190 3 220
Rockets 5 180 1 0 2 0 3 100
Penguins 1 15 3 120 1 300 4 0
Marsupials 9 0 3 100 2 220 3 80Sample OutputPenguins 3 475SourceMid-Atlantic 2003
Regionals 2003 >> North America - Mid-Atlantic USA
问题链接:POJ1581 HDU1304 ZOJ1764 UVALive2832 A Contesting Decision
问题简述:(略)
问题分析:
这是一个ACM比赛排名计算问题。计算规则与实际的比赛是相同的。
这个问题也是一个求最值的问题。如果使用结构数组,或使用排序来实现,那都是浮云。
程序需要做得通用,不论多大的n都能够处理才是王道。
程序说明: 结构数据放入结构中存储是一种好的做法,使得程序的逻辑结构看起来更加简洁易懂。
程序中需要算完成题数和罚时,这两个值也放入结构中,分别用结构成员变量total和time来存储。
题记:(略)
参考链接:(略)
AC的C++语言程序如下:
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 3243 | Accepted: 2192 |
Judging a programming contest is hard work, with demanding contestants, tedious decisions,and monotonous work. Not to mention the nutritional problems of spending 12 hours with only donuts, pizza, and soda for food. Still, it can be a lot of fun.
Software that automates the judging process is a great help, but the notorious unreliability of some contest software makes people wish that something better were available. You are part of a group trying to develop better, open source, contest management software, based on the principle of modular design.
Your component is to be used for calculating the scores of programming contest teams and determining a winner. You will be given the results from several teams and must determine the winner.
Scoring
There are two components to a team's score. The first is the number of problems solved. The second is penalty points, which reflects the amount of time and incorrect submissions made before the problem is solved. For each problem solved correctly, penalty points are charged equal to the time at which the problem was solved plus 20 minutes for each incorrect submission. No penalty points are added for problems that are never solved.
So if a team solved problem one on their second submission at twenty minutes, they are charged 40 penalty points. If they submit problem 2 three times, but do not solve it, they are charged no penalty points. If they submit problem 3 once and solve it at 120 minutes, they are charged 120 penalty points. Their total score is two problems solved with 160 penalty points.
The winner is the team that solves the most problems. If teams tie for solving the most problems,then the winner is the team with the fewest penalty points.InputFor the programming contest your program is judging, there are four problems. You are guaranteed that the input will not result in a tie between teams after counting penalty points.
Line 1 < nTeams >
Line 2 - n+1 < Name > < p1Sub > < p1Time > < p2Sub > < p2Time > ... < p4Time >
The first element on the line is the team name, which contains no whitespace.Following that, for each of the four problems, is the number of times the team submitted a run for that problem and the time at which it was solved correctly (both integers). If a team did not solve a problem, the time will be zero. The number of submissions will be at least one if the problem was solved.OutputThe output consists of a single line listing the name of the team that won, the number of problems they solved, and their penalty points.Sample Input4
Stars 2 20 5 0 4 190 3 220
Rockets 5 180 1 0 2 0 3 100
Penguins 1 15 3 120 1 300 4 0
Marsupials 9 0 3 100 2 220 3 80Sample OutputPenguins 3 475SourceMid-Atlantic 2003
Regionals 2003 >> North America - Mid-Atlantic USA
问题链接:POJ1581 HDU1304 ZOJ1764 UVALive2832 A Contesting Decision
问题简述:(略)
问题分析:
这是一个ACM比赛排名计算问题。计算规则与实际的比赛是相同的。
这个问题也是一个求最值的问题。如果使用结构数组,或使用排序来实现,那都是浮云。
程序需要做得通用,不论多大的n都能够处理才是王道。
程序说明: 结构数据放入结构中存储是一种好的做法,使得程序的逻辑结构看起来更加简洁易懂。
程序中需要算完成题数和罚时,这两个值也放入结构中,分别用结构成员变量total和time来存储。
题记:(略)
参考链接:(略)
AC的C++语言程序如下:
/* POJ1581 HDU1304 ZOJ1764 UVALive2832 A Contesting Decision */ #include <iostream> using namespace std; const int N = 4; const int M20 = 20; struct team { string name; int psub , ptime ; int total, time; } maxv, a; int main() { int n; maxv.total = -1; cin >> n; for(int i=1; i<=n; i++) { // 输入数据:一个队 cin >> a.name; for(int j=0; j<N; j++) cin >> a.psub[j] >> a.ptime[j]; // 计算题数和用时(total, time) a.total = 0; a.time = 0; for(int j=0; j<N; j++) if(a.ptime[j] > 0) { a.total++; a.time += a.ptime[j] + (a.psub[j] - 1) * M20; } // 选取最大值 if(a.total > maxv.total) { maxv.name = a.name; maxv.total = a.total; maxv.time = a.time; } else if(a.total == maxv.total && a.time < maxv.time) { maxv.name = a.name; maxv.total = a.total; maxv.time = a.time; } } cout << maxv.name << " " << maxv.total << " " << maxv.time << endl; return 0; }
相关文章推荐
- UVALive2953 POJ1775 ZOJ2358 Sum of Factorials【打表+暴力+水题】
- ZOJ1159 UVA755 UVALive5420 487-3279【查表】
- UVALive-7297-Hounded by Indecision
- POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom /ZOJ 1291 MPI Maelstrom (最短路径)
- UVALive 3490 (LA 3940) || ZOJ 2619 Generator AC自动机(或KMP) + 整数高斯消元 + 数学期望
- POJ 2296 Map Labeler / ZOJ 2493 Map Labeler / HIT 2369 Map Labeler / UVAlive 2973 Map Labeler(2-sat 二分)
- POJ1555 ZOJ1720 UVA392 UVALive5309 Polynomial Showdown题解
- UVALive2362 POJ1004 HDU1064 ZOJ1048 Financial Management【数学计算+水题】
- UVALive5389 UVA414 POJ1493 ZOJ1339 Machined Surfaces【输入输出+水题】
- POJ 1087 A Plug for UNIX / HDU 1526 A Plug for UNIX / ZOJ 1157 A Plug for UNIX / UVA 753 A Plug for UNIX / UVAlive 5418 A Plug for UNIX / SCU 1671 A Plug for UNIX (网络流)
- UVALive2389 ZOJ1078 Palindrom Numbers
- POJ1060 HDU1343 ZOJ1026 UVALive2323 Modular multiplication of polynomials题解
- POJ 2296 Map Labeler / ZOJ 2493 Map Labeler / HIT 2369 Map Labeler / UVAlive 2973 Map Labeler
- UVA713 UVALive5539 POJ1504 ZOJ2001 Adding Reversed Numbers
- POJ1060 HDU1343 ZOJ1026 UVALive2323 Modular multiplication of polynomials(多项式模2除)
- POJ 2149 & ZOJ 2267&UVA 1337&UVALive 3192 Inherit the Spheres
- POJ 1511 Invitation Cards / UVA 721 Invitation Cards / SPOJ Invitation / UVAlive Invitation Cards / SCU 1132 Invitation Cards / ZOJ 2008 Invitation Cards / HDU 1535 (图论,最短路径)
- UVALive2536 POJ1248 HDU1015 ZOJ1403 Safecracker【密码+暴力+水题】
- POJ 1459 Power Network / HIT 1228 Power Network / UVAlive 2760 Power Network / ZOJ 1734 Power Network / FZU 1161 (网络流,最大流)
- UVALive2356 ZOJ1061 Web Navigation【堆栈+模拟】