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$表示存在一种 ...
随机推荐
- Servlet学习应该注意的几点
一.Servlet生命周期(即运行过程) (1)初始阶段,调用init()方法 (2)响应客户请求阶段,调用service()方法.由service()方法根据提交方式不同执行doGet()或doPo ...
- 15 Validation
一.模型选择问题 如何选择? 视觉上 NO 不是所有资料都能可视化;人脑模型复杂度也得算上 通过Ein NO 容易过拟合;泛化能力差 通过Etest NO 能保证好的泛化,不过往往没法提前获得测试资料 ...
- 使用 Dawn 构建 React 项目
开发一个 React 项目,通常避免不了要去配置 Webpack 和 babel 之类,以支持 commonjs 或 es 模块及各种 es 新语法,及及进行 jsx 语法的转义.当然也可以用 cre ...
- Deep learning:一(基础知识_1)
本文纯转载: 主要是想系统的跟tornadomeet的顺序走一遍deeplearning; 前言: 最近打算稍微系统的学习下deep learing的一些理论知识,打算采用Andrew Ng的网页教程 ...
- Zabbix(一) : 简介以及Server端安装
一.什么是Zabbix? zabbix由AlexeiVladishev首先开发,目前在维护的是Zabbix SIA.ZABBIX是一个企业级的开源分布式监控解决方案. zabbix为监控网络和服务器的 ...
- Python tkinter调整元件在窗口中的位置与几何布局管理
Tkinter中的GUI总是有一个root窗口,不管你是主动或者别动获得.主窗口就是你的程序开始运行的时候创建的,在主窗口中你通常是放置了你主要的部件.另外,Tkinter脚本可以依据需要创建很多独立 ...
- WPF: ShowDialog() 切换到其他应用窗口后,再切换回来无法让子窗口总在最上方
按说ShowDialog()是模态窗口,应该在主窗口的上方,但是打开其他应用窗口再切换回来的时候,发现子窗口不见了,主窗口又不能操作. 另外子窗口设置成不在任务栏显示,只能通过Alt-Tab来切换到子 ...
- Ubuntu16.04下Office替代品Office Online
Ubuntu16.04下Office替代品 Ubuntu16.04下的office Libreoffice 这个是Ubuntu自带的Office,总是存在各种问题,如果用来阅读还是不错的,但是编辑就不 ...
- mysql在cmd命令下执行数据库操作
windows+r 运行cmd命令,执行以下操作! 当mysql 数据库文件相对于来说比较大的时候,这个时候你可能在正常环境下的mysql中是导入不进去的,因为mysql数据库本身就有默认的导入文件大 ...
- oracle11G r2 静默安装单实例(待优化版)
测试环境:centos 6.9 X64 mini 版 oracle版本:11G r2 Oracle软件包:db_112040_Linux-x86-64_1of7.zip;db_112040_Linux ...