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. c# 控制IE浏览器

    原文 http://www.cnblogs.com/love2wllw/archive/2010/05/19/1739327.html 想写一个桌面程序,用C#.程序运行后,会用IE打开指定的网页,并 ...

  2. fragment点击跳转到外部Activity后,怎么通过返回按钮返回

    楼主的情况应该是比较简单的吧,跟三楼说的一样,只要在D跳到下一个Activity的时候,D所在的Activity不要调用finish(),然后在下一个Activity关闭的时候直接调用finish() ...

  3. (?m) 标记

    <pre name="code" class="html">在和 codec/multiline 搭配使用的时候,需要注意一个问题,grok 正则和 ...

  4. 导入时如何定制spring-boot依赖项的版本

    spring-boot通过maven的依赖管理为我们写好了很多依赖项及其版本,我们可拿来使用.spring-boot文档介绍了两种使用方法,一是继承,二是导入. 通过<parent>继承: ...

  5. Binary Tree Level Order Traversal 解答

    Question Given a binary tree, return the level order traversal of its nodes' values. (ie, from left ...

  6. Clone使用方法详解【转载】

    博客引用地址:Clone使用方法详解 Clone使用方法详解   java“指针”       Java语言的一个优点就是取消了指针的概念,但也导致了许多程序员在编程中常常忽略了对象与引用的区别,本文 ...

  7. 【思路题】【多校第一场】【1001.OO’s Sequence】

    题目大意: 给你一个序列A,f(l,r) 表示 在[l,r]中 的Ai 对于每一个数Aj 都有 Ai%Aj!=0  的数目(  i!=j  ) 卡了一段时间..... 题解 简单题 定义两个数组L[i ...

  8. js数字验证

    1.JS判断只能是数字和小数点 1.文本框只能输入数字代码(小数点也不能输入) <input onkeyup="this.value=this.value.replace(/\D/g, ...

  9. PDO扩展使用方法

    pdo扩展为php访问数据库提供了一个轻量级的一致接口,pdo提供了一个数据访问抽象层,这意味着不管使用哪种数据库,都可以使用相同的函数来查询和获取数据. $dbms='mysql'; //数据库类型 ...

  10. HDU 2157 - How many ways??

    给图,图中任意可达的两点间步数为1 问从图中A点走到B点步数为k的有几条路 祭出离散数学图论那章中的 邻接矩阵A. 设S=Ak 则 S[a][b] 为 a到b,步数为k的不同路的条数 剩下的就是矩阵快 ...