Problem G
race for two or more teams of runners. Each member of a team runs
one section of the race. Your task is to help to evaluate the
results of a relay race.
You have to process several teams. For each team you are given a
list with the running times for every section of the race. You are
to compute the average time per kilometer over the whole distance.
That's easy, isn't it?
So if you like the fun and challenge competing at this contest,
perhaps you like a relay race, too. Students from Ulm participated
e.g. at the "SOLA" relay in Zurich, Switzerland. For more
information visit http://www.sola.asvz.ethz.ch/ after the contest
is over.
of the input specifies the number of sections n followed by the
total distance of the relay d in kilometers. You may safely assume
that 1 <= n <= 20 and 0.0 < d < 200.0. Every following
line gives information about one team: the team number t (an
integer, right-justified in a field of width 3) is followed by the
n results for each section, separated by a single space. These
running times are given in the format "h:mm:ss" with integer
numbers for the hours, minutes and seconds, respectively. In the
special case of a runner being disqualified, the running time will
be denoted by "-:--:--". Finally, the data on every line is
terminated by a newline character. Input is terminated by
EOF.
output exactly one line giving the team's number t right aligned in
a field of width 3, and the average time for this team rounded to
whole seconds in the format "m:ss". If at least one of the team's
runners has been disqualified, output "-" instead. Adhere to the
sample output for the exact format of presentation.
12.5
0:25:01
-:--:--
0:41:35
min/km
min/km
15MS)
#include
using namespace std;
int main()
{
//freopen("in.txt", "r", stdin);
int
n,t,h,m,s,time_s;
double
d;
bool
flag;
scanf("%d
%lf",&n,&d);
while(cin>>t)
{
flag=1;
time_s=0;
for(int i=0;i
{
char str;
cin>>str;
if(str=='-')
{
cin>>str>>str>>str>>str>>str>>str;
flag=0;
continue;
}
else
{
scanf("%*c%d%*c%d",&m,&s);//%*c的意思就是跳过这个不输入了
time_s+=(s+m*60+(str-'0')*3600);
}
}
if(!flag)
printf("=: -\n", t);
else
{
int ave=1.0*time_s/d+0.5;
m=ave/60;
s=ave`;
printf("=: %d:d min/km\n", t, m, s);
}
}
return
0;
}
Problem G的更多相关文章
- 实验9:Problem G: 克隆人来了!
想要输出""的话: cout<<"A person whose name is \""<<name<<" ...
- 实验12:Problem G: 强悍的矩阵运算来了
这个题目主要是乘法运算符的重载,卡了我好久,矩阵的乘法用3个嵌套的for循环进行,要分清楚矩阵的乘法结果是第一个矩阵的行,第二个矩阵的列所组成的矩阵. 重载+,*运算符时,可以在参数列表中传两个矩阵引 ...
- 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem G: Check The Check(模拟国际象棋)
Problem G: Check The Check Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 10 Solved: 3[Submit][Statu ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem G
Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student n ...
- 【贪心+中位数】【新生赛3 1007题】 Problem G (K)
Problem G Time Limit : 4000/2000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Sub ...
- Problem G: If We Were a Child Again
Problem G: If We Were a Child AgainTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 14[Submi ...
- Problem G: Keywords Search
Problem G: Keywords SearchTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 10 Solved: 6[Submit][Status] ...
- BZOJ4977 八月月赛 Problem G 跳伞求生 set 贪心
欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - BZOJ4977 - 八月月赛 Problem G 题意 小明组建了一支由n名玩家组成的战队,编号依次为1到n ...
- Western Subregional of NEERC, Minsk, Wednesday, November 4, 2015 Problem G. k-palindrome dp
Problem G. k-palindrome 题目连接: http://opentrains.snarknews.info/~ejudge/team.cgi?SID=c75360ed7f2c7022 ...
- ZOJ 4010 Neighboring Characters(ZOJ Monthly, March 2018 Problem G,字符串匹配)
题目链接 ZOJ Monthly, March 2018 Problem G 题意 给定一个字符串.现在求一个下标范围$[0, n - 1]$的$01$序列$f$.$f[x] = 1$表示存在一种 ...
随机推荐
- Jupyter(Python)中无法使用Cache原理分析
前言 最近需要在Jupyter中写一个类库,其中有一个文件实现从数据库中读取空间数据并加载为Feature对象,Feature对象是cartopy封装的geomery列表,能够方便的用于作图等.因为有 ...
- AngularJS -- Bootstrap(启动器)
点击查看AngularJS系列目录 转载请注明出处:http://www.cnblogs.com/leosx/ Bootstrap(初始化) 这章介绍了Angular的初始化过程,以及如何在必要的时候 ...
- iOS连续dismiss几个ViewController的方法
原文链接:http://blog.csdn.net/longshihua/article/details/51282388 presentViewController是经常会用到的展现ViewCont ...
- 第一次安装jshint,jshint新手使用记录
刚刚出来工作的渣渣,第一次进入这样比较正规的公司,各个开发流程都比较严格,代码也是要经过jshint的检测才能上传到svn才能成功打包项目.所以我这种技术都半桶水的职场开发小白,也是第一次用jshin ...
- Linux入门之常用命令(11) 系统监控 vmstat top
vmstat命令是最常见的Linux/Unix监控工具,可以展现给定时间间隔的服务器的状态值,包括服务器的CPU使用率,内存使用,虚拟内存交换情况,IO读写情况.这个命令是我查看Linux/Unix最 ...
- Charles Proxy v4.1.4 免费注册激活方法
去官网下载最新版Charles,目前是v4.1.4 下载后安装Charles,然后先打开一次Charles软件(Mac系统需要先打开一次,Windows不需要) 到网站 http://charles. ...
- ES中const
前 言 EScript 上一次总结了,ES中let和var的区别,今天在带大家了解另一个声明关键词:const. const实际上保证的,并不是变量的值不得改动,而是变量指向的那个内存地址不得改 ...
- 最常用前端框架BootStrap——栅格系统
前 言 Bootstrap 提供了一套响应式.移动设备优先的流式栅格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多12列.它包含了易于使用的预定义类,还有强大的mix ...
- Google Authenticator 如何集成(U盾的实现原理相同)
Google Authenticator是一个类似U盾的二次验证工具,Google提供了它的开源客户端(https://github.com/google/google-authenticator)里 ...
- FPGA在其他领域的应用(四)
工业领域: 从工厂和过程自动化到能源基础设施和机器视觉系统,工业产品有助于改善我们的世界.产品必须安全.可靠.适应性强,而且耐用.同时,商业成功要求你在激烈竞争的市场中行动迅速,同时降低总成本. 英特 ...