poj1581
| Time Limit: 1000MS | Memory Limit: 10000K | |
| Total Submissions: 2519 | Accepted: 1786 |
Description
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
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
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
#include <iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int penaliy = ; int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
char str[];
int a[],b[];
int maxsolved = -;
int mintime = ;
char winner[];
for(int i=;i<n;i++)
{
scanf("%s%d%d%d%d%d%d%d%d",str,&a[],&b[],&a[],&b[],&a[],&b[],&a[],&b[]);
int solved = ;
int time = ;
for(int j=;j<;j++)
{
if(b[j]!=)
{
solved++;
time+=b[j]+(a[j]-)*penaliy;
}
}
if(maxsolved<solved)
{
strcpy(winner,str);
maxsolved = solved;
mintime = time ;
}
else if(maxsolved==solved)
{
if(mintime>time)
{
mintime=time;
strcpy(winner,str);
maxsolved = solved;
}
}
}
cout<<winner<<" "<<maxsolved<<" "<<mintime<<endl;
}
return ;
}
poj1581的更多相关文章
- 【POJ1581】A Contesting Decision(简单模拟)
没有什么弯路,直接模拟即可.水题. #include <iostream> #include <cstring> #include <cstdlib> #inclu ...
随机推荐
- CEF3 怎样禁止右键菜单
CEF3 怎样禁止右键菜单 (2013-07-30 11:56:34)转载▼标签: cef3 右键菜单 分类: CEF3问题描述:CEF3 嵌入成功后,在网页点鼠标右键,出现英文菜单,应该怎样禁止掉呢 ...
- 点击Winform右下角图标,在最前端展示窗口
//调用Windows API 展示窗口到最前端 SwitchToThisWindow(this.Handle, true);//窗体的句柄 this.Handle SwitchToThisW ...
- 窗口变化相关消息 OnSize、OnSizing和OnGetMinMaxInfo
最近用到窗口变化的一些东西,遇到几个相关的消息函数,简要分析,作为备忘. 3个消息分别是:WM_SIZE.WM_SIZING.WM_GETMINMAXINFO:分别对应相应的处理函数:OnSize.O ...
- 一些.Net面试题 (BS 方向)
http://www.cnblogs.com/PurpleTide/archive/2012/03/10/2389496.html 解决方案和思路类: 设计和策略: 1.有一个网站的中购买功能, 假设 ...
- 怎样使用LaTeX输入葡萄牙语等语言中的特殊字符
论文中引用了大名鼎鼎ER random graph model,但是这两位的名字不太好打,发现Google Scholar中直接下载的bib文件中也是错的.找了一会,发现转义字符已经定义得很好了.只是 ...
- 二十七、Java图形化界面设计——容器(JFrame)
摘自http://blog.csdn.net/liujun13579/article/details/7756729 二十七.Java图形化界面设计--容器(JFrame) 程序是为了方便用户使用的, ...
- LINUX下 Udev详解
如果你使用Linux比较长时间了,那你就知道,在对待设备文件这块,Linux改变了几次策略.在Linux早期,设备文件仅仅是是一些带有适当的属性集的普通文件,它由mknod命令创建,文件存放在/dev ...
- wpf动画概述
http://msdn.microsoft.com/zh-cn/library/vstudio/ms752312(v=vs.100).aspx Windows Presentation Foundat ...
- Android窗口管理服务WindowManagerService的简要介绍和学习计划
在前一个系列文章中,我们从个体的角度来分析了Android应用程序窗口的实现框架.事实上,如果我们从整体的角度来看,Android应用程序窗口的 实现要更复杂,因为它们的类型和作用不同,且会相互影响. ...
- HA高可用的搭建
HA 即 (high available)高可用,又被叫做双机热备,用于关键性业务. 简单理解就是,有两台机器A和B,正常是A提供服务,B待命闲置,当A宕机或服务宕掉,会切换至B机器继续提供服务.常用 ...