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 ;
}

最新文章

  1. Android下使用Properties文件保存程序设置
  2. mysql5.5手册读书日记(2)
  3. Jar依赖很多,找不到重复的包??好工具来帮助您
  4. asp中cookie欺骗/注入原理与防范
  5. sed命令拷屏
  6. TChromeTabs 使用日记
  7. c#打印机设置,取得打印机列表及相应打印机的所有纸张格式
  8. 长沙Uber优步司机奖励政策(2月1日~2月7日)
  9. 轻松搞定javascript日期格式化问题
  10. Mysql中设置默认时间为当前值
  11. fuzzing学习
  12. c# 制作正方形图片
  13. SPARK-18560
  14. USB协议枚举过程详解
  15. 修改Linux下的文件以及文件夹的权限
  16. bloom-server 基于 rust 编写的 rest api cache 中间件
  17. python测试开发django-34.xadmin管理后台
  18. Python import random报错处理办法
  19. ASI接口
  20. 学习Selenium同学必看

热门文章

  1. 编译boost python模块遇到的错误:../../libraries/boost_1_44_0/boost/python/detail/wrap_python.hpp:75:24: fatal error: patchlevel.h: No such file or directory
  2. 【转】如何定制android源码的编译选项 &amp; 后期安装? ---- 不错
  3. zoj3433(贪心+优先队列)
  4. 【LeetCode练习题】Unique Paths II
  5. Python load json file with UTF-8 BOM header - Stack Overflow
  6. linux多线程socket编程一些心得
  7. 九度OnlineJudge之1032:ZOJ
  8. MonoDevelop with Visual Studio to Linux and Mac OSX maintaining a single code base for all platforms.
  9. hdu 4750 Count The Pairs (2013南京网络赛)
  10. Chord算法实现具体