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. tr 替换删除字符

    1.关于tr    通过使用 tr,您可以非常容易地实现 sed 的许多最基本功能.您可以将 tr 看作为 sed 的(极其)简化的变体:它可以用一个字符来替换另一个字符,或者可以完全除去一些字符.您 ...

  2. 《深入了解 Linq to SQL》之对象的标识 —— 麦叔叔呕心呖血之作

    序言 很多朋友都向我提过,希望我写一下关于Linq to SQL 或者 VS 插件方面的文章.尽管市面上有很多 Linq to SQL 的书籍,但是都是介绍怎么用,缺乏深度.关于 VS 插件方面的书籍 ...

  3. 【转】Android LCD(三):Samsung LCD接口篇

    关键词:android LCD控制器 Framebuffer PWM  平台信息:内核:linux2.6/linux3.0系统:android/android4.0 平台:samsung exynos ...

  4. iOS 实时监听app的网络连接状态

    实际iOS开发中,在网络通信中我们大部分使用第三方(只谈短链),譬如 AFNetworking.ASIHttpRequest(这个停更了,想必现在没多少人用),swift的 Alamofire 等. ...

  5. 模块工具类--utils

    File: js\utils.js/** * 模块工具类,用来初始化各模块视图.自定绑定事件以及其他辅助功能等 * @class Utils */Utils = (function() { var i ...

  6. 精讲N皇后问题

             思想:存三个数组记录记录走的过程,运用回溯不符合或row==n+1就跳出当前层,直到找完:递归时的路径都在保存着,当连续跳出到第一次进入的dfs且i=n时就全部跳出dfs函数了: # ...

  7. telnet如何操作Memcached缓存系统?

    4.(1)telnet操作Memcached 许多语言都实现了连接memcached的客户端,其中以Perl.PHP为主.仅仅memcached网站上列出的语言就有:• Perl • PHP • Py ...

  8. crm使用url打开窗口视图

    //URL可寻址元素使您能够包含指向Microsoft Dynamics CRM窗口. 视图. 对话框和其它应用程序中的报告. //这样.您就能够轻松扩展其它应用程序.报表或站点,以便用户无需切换应用 ...

  9. jQuery -&gt; end方法的使用方法

    我们在对结果集使用find.filter等方法时,会改变结果集. 这样的改变原先结果集的方法被称作destructive jQuery method jQuery cookbook有例如以下定义: A ...

  10. react-native 环境配置及hello world

    一.前言 最近手头的工作繁多,有研究性的项目和系统研发,正好遇到同事离职,接手了框架的UI组件,不仅需要维护和填坑,还需要开发新的功能组件.因为身在H5-Hybird的框架部门,最近团队开始尝试使用R ...