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 ...
随机推荐
- SQL Server索引语法 <第四篇>
从CREATE开始 通过显式的CREATE INDEX命令 在创建约束时作为隐含的对象 随约束创建的隐含索引 当向表中添加如下两种约束之一时,就会创建隐含索引. 主键约束(聚集索引) 唯一约束(唯一索 ...
- cf478C Table Decorations
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...
- OpenWrt 学习网址
http://m.blog.csdn.net/blog/woods2001/8137755
- iOS 删除相册中照片--来自简书
来自:http://www.jianshu.com/p/ac18aa3f28c2 最近公司的app有一个新功能是在app中删除相册的照片 ,本来是一个比较简单地功能,在做的过程中却发现AssetsLi ...
- Android技术路线图
邮件问题: 老师你好,我从去年就在看你的关于Android的视频了,的确讲的不错,去年看了一段时间,寒假的时候回家重新复习了一下Java基础知识,开学的时候看到你又陆续出了一些视频,这段时间看完了,跟 ...
- windows查看端口占用情况及查杀进程
我们平时在做web开发运行web服务器或运行某个应用时会报错,提示该应用的端口号已被占用,我们可以用以下的方法解决. 解决方法一:重新为应用配置端口. 解决方法二:找到占用端口的应用并关闭该应用释放占 ...
- convertView
[convertView] 参考:https://zhidao.baidu.com/question/423895201122905772.html
- 在国内使用cnpm代替npm
npm是Node.js的模块依赖管理工具,由于使用npm安装包是从国外服务器下载,在国内很容易受到网络的影响,速度非常慢,因此可以选用cnpm.cnpm可以使用淘宝团队提供的淘宝npm镜像,你可以用此 ...
- 【计算几何初步:多边形中心】【HDU1115】Lifting the Stone
一.质点系重心公式 x=(x1*m1+x2*m2+x3*m3.....xn*mn)/M (M=m1+m2+m3+m4...+mn) 二.三角形重心 可直接求得,但在多边形剖分中 各三角形的质点的质量 ...
- Sql中的Exists和in
最近学习数据库的分页算法,提到第一种 SELECT TOP 页大小 *FROM table1WHERE id NOT IN ( SELECT TOP 页大小*(页数 ...