A Contesting Decision
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 2519   Accepted: 1786

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

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的更多相关文章

  1. 【POJ1581】A Contesting Decision(简单模拟)

    没有什么弯路,直接模拟即可.水题. #include <iostream> #include <cstring> #include <cstdlib> #inclu ...

随机推荐

  1. 【总结】OJ练习,进行的一些编程语言方面总结

    1.STL vector只有四个构造函数 ) explicit vector (const allocator_type& alloc = allocator_type()); fill () ...

  2. 关于随机数字K线极值的统计结果

    如果有组随机数字,如数字彩票.我们对号码进行平均二分后,统计期出现的结果分布,对结果分布进行K线累加,得到一条折线. 这条折线的顶点和底点的统计上服从以下规则: 令总期数为N,统计区间为M,则在N期内 ...

  3. HDMI相关知识

    HDMI热插拔检测原理 HDMI(19Pin)/DVI(16 pin)的功能是热插拔检测(HPD),这个信号将作为主机系统是否对HDMI/DVI是否发送TMDS信号的依据.HPD是从显示器输出送往计算 ...

  4. Maven引入hadoop依赖包出错解决办法

    错误: ArtifactTransferException: Failure to transfer org.apache.hadoop:hadoop-hdfs:jar:2.6.0 from http ...

  5. 代码中实际运用memcached——.NET

    本文取自:http://blog.csdn.net/dyllove98/article/details/9115947 memcached安装:============================ ...

  6. 左右HttpClient上传的方法来解决中国的乱码

    二手HttpClient人们都知道通过addTextBody方法来加入要上传的文本信息,可是,假设要上传中文的话.或还有中文名称的文件会出现乱码的问题,解决的方法事实上非常easy: 第一步:设置Mu ...

  7. 深入浅出NodeJS——异步I/O

    底层操作系统,异步通过信号量.消息等方式有着广泛的应用. PHP语言从头到尾都是以同步堵塞方式执行,利于程序猿顺序编写业务逻辑. 异步I/O.事件驱动.单线程构成Node的基调. why异步I/O ( ...

  8. ECSHOP用户评论

    可以不需要审核吗?现在的用户评论要审核才能显示 ,我需要不用审核就可以显示可以么? 在论坛上看见这个问题,顺便就记录下来吧. 这个是可以的,下面是操作步骤 后台->系统设置->商店设置-& ...

  9. CSS的base文件常用代码

    article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,but ...

  10. github教程--廖雪峰的官方网站

    http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000