Problem Description
A relay is a 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.

 
Input
The first line 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
For each team 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.
 
Sample Input
2 12.5
   5 0:23:21 0:25:01
 42 0:23:32 -:--:--
   7 0:33:20 0:41:35
 
Sample Output
  5: 3:52 min/km
42: -
  7: 6:00 min/km
 
Code:
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <ctype.h> using namespace std; int main()
{
int n,num;
float d;
char tim[];
scanf("%d%f",&n,&d); while(scanf("%d",&num)!=EOF)
{
float seconds=;
int flag=;
for(int i=;i<n;i++)
{ scanf("%s",&tim);
if(tim[]=='-')
flag=;
else
seconds+=(tim[]-'')*+((tim[]-'')*+tim[]-'')*+(tim[]-'')*+tim[]-'';
}
int k=seconds/d+0.5;
if(flag)
printf("%3d: -\n",num);
else
printf("%3d:%2d:%02d min/km\n",num,k/,k%); }
return ;
}

HDU1036 Average is not Fast Enough!的更多相关文章

  1. HDU-1036 Average is not Fast Enough!

    Average is not Fast Enough! http://acm.hdu.edu.cn/showproblem.php?pid=1036 Problem Description A rel ...

  2. hdoj-1036-Average is not Fast Enough!(水题,坑)

     题目链接:Average is not Fast Enough! #include <iostream> #include <cstring> #include <st ...

  3. hdu_1036_Average is not Fast Enough_201311021335

    Average is not Fast Enough! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (J ...

  4. hdu 1036 (I/O routines, fgets, sscanf, %02d, rounding, atoi, strtol) 分类: hdoj 2015-06-16 19:37 32人阅读 评论(0) 收藏

    thanks to http://stackoverflow.com/questions/2144459/using-scanf-to-accept-user-input and http://sta ...

  5. 杭电ACM分类

    杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...

  6. HOJ题目分类

    各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...

  7. 【C#】转一篇MSDN杂志文:ASP.NET Pipeline: Use Threads and Build Asynchronous Handlers in Your Server-Side Web Code

    序:这是一篇发表在2003年6月刊的MSDN Magazine的文章,现在已经不能在线阅读,只提供chm下载.讲的是异步请求处理那些事,正是我上一篇博文涉及的东西(BTW,事实上这篇杂志阐述了那么搞然 ...

  8. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  9. training 2

    Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.136 Average Precision (AP) @[ IoU ...

随机推荐

  1. Java基础学习之线程

    1.尽量避免直接使用 同步.Thread等原生操作线程的类,可以通过java.util.concurrent下对底层包装好的类进行操作, ReentrantLock:lock trylock  unl ...

  2. javascript学习笔记(一):词法结构

    一:字符集 javascript程序是用Unicode字符集编写的. 二:区分大小写 javascript是区分大小写的语言,但需注意的是HTML不区分大小写 三:空格.换行符和格式控制符 javas ...

  3. ASP.NET MVC5(四):数据注解和验证

    前言 用户输入验证的工作,不仅要在客户端浏览器中执行,还要在服务端执行.主要原因是客户端验证会对输入数据给出即时反馈,提高用户体验:服务器端验证,主要是因为不能完全信任用户提供的数据.ASP.NET ...

  4. asp.net core中负载均衡场景下http重定向https的问题

    上周欣喜地发现,微软官方终于针对 asp.net core 在使用负载均衡的情况下从 http 强制重定向至 https 的问题提供了解决方法. app.UseForwardedHeaders(new ...

  5. python制作pdf电子书

    python制作pdf电子书 准备 制作电子书使用的是python的pdfkit这个库,pdfkit是 wkhtmltopdf 的Python封装包,因此在安装这个之前要安装wkhtmltopdf 安 ...

  6. mysql 发生系统错误 1067

    最近要搞一个免安装版的mysql,原来的配置在d盘的my.ini如下 [client]port=3306default-character-set=utf8 [mysqld]port=3306char ...

  7. MySQL NULL值

    我们已经看到SQL SELECT命令和WHERE子句一起使用,来从MySQL表中提取数据, 但是,当我们试图给出一个条件,比较字段或列值设置为NULL,它确不能正常工作. 为了处理这种情况,MySQL ...

  8. 从app上传图片到php,再上传到java后端服务器的方法一览

    在现在的网络开发中,上传图片类的需求实在是太普通不过了,但是对于怎么样做到上传图片,对于刚开始建立项目的时候,还是有点不知所措的.也许有幸,我们做的项目是之前已经有人写过类似的用例了,那么我们只需要依 ...

  9. USACO Healthy Holsteins

    首先看题目: Healthy HolsteinsBurch & Kolstad Farmer John prides himself on having the healthiest dair ...

  10. eclipse从SVN检出项目之后,项目出错

    今天公司把我分配到另一个项目组工作,然后下午使用SVN检出项目,出了问题 1.从SVN检出项目之后,要导入jar包.结果右键项目找不到Build Path,问了大牛才知道是这里的问题,一共四个步骤解决 ...