POJ 1581 A Contesting Decision 水
2015-08-05 19:36
423 查看
A Contesting Decision
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.
Input
For 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.
Output
The 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 Input
Sample Output
Source
Mid-Atlantic 2003
AC代码:
A Contesting Decision
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 2704 | Accepted: 1910 |
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.
Input
For 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.
Output
The 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 Input
4 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 80
Sample Output
Penguins 3 475
Source
Mid-Atlantic 2003
AC代码:
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <cctype> using namespace std; struct team{ string name; int s1,t1,s2,t2,s3,t3,s4,t4; int total,time; }; int main(){ team my[100]; int i,n,t; cin>>n; int max=-1; for(i=0;i<n;++i){ my[i].time=0; cin>>my[i].name >>my[i].s1>>my[i].t1 >>my[i].s2>>my[i].t2 >>my[i].s3>>my[i].t3 >>my[i].s4>>my[i].t4; int cns=0; if(my[i].t1){ cns++; my[i].time+=(my[i].s1-1)*20+my[i].t1; } if(my[i].t2){ cns++; my[i].time+=(my[i].s2-1)*20+my[i].t2; } if(my[i].t3){ cns++; my[i].time+=(my[i].s3-1)*20+my[i].t3; } if(my[i].t4){ cns++; my[i].time+=(my[i].s4-1)*20+my[i].t4; } my[i].total=cns; if(cns>max){ max=cns; t=i; }else if(cns==max){ if(my[i].time<my[t].time) t=i; } } cout<<my[t].name<<" "<<my[t].total<<' '<<my[t].time<<'\12'; return 0; }
相关文章推荐
- LCS转为LIS
- ABP(现代ASP.NET样板开发框架)系列之19、ABP应用层——审计日志
- AJAX提交方法(POST)Demon
- jQuery/HTML5响应式焦点图动画应用
- linux LIBRARY_PATH
- Spark历险记之编译和远程任务提交
- Num 20 : HDOJ: 题目1402 : A*B ( 大数问题 )
- C++命名规范
- JSP传递参数到JS中的方法和问题
- HASH表的实现(拉链法) - C/C++
- POJ 1552 Doubles 水
- LeetCode(103) Binary Tree Zigzag Level Order Traversal
- JSP使用EL获取并显示用户注册信息。
- jQuery 3D 女神图片墙 可旋转播放
- sitemesh
- 非负分数的循环小数位长度
- Arttemplate 前端模板引擎
- 【讨论贴】关于父实子虚的疑问???
- POJ 1338 Ugly Numbers dp
- SharePoint 2010 vs SharePoint 2013