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
题意:这题很水,给出总共跑几圈,每圈的用时,求出一千米多少时间;
解题思路:这个题很水,刚开始看的时候,一看输入输出就不想做了,里面有时间,很麻烦,就放到最后写,心思这用类写。。。。我去,看懂题意之后(全是脏话),这么水,就是输入输出有点难度,用cin的话可以免去很多不必要的麻烦;
感悟:水题(老师0.0,以后输入输出弄得容易看点都乱码了)
代码(G++
15MS)
#include

#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的更多相关文章

  1. 实验9:Problem G: 克隆人来了!

    想要输出""的话: cout<<"A person whose name is \""<<name<<" ...

  2. 实验12:Problem G: 强悍的矩阵运算来了

    这个题目主要是乘法运算符的重载,卡了我好久,矩阵的乘法用3个嵌套的for循环进行,要分清楚矩阵的乘法结果是第一个矩阵的行,第二个矩阵的列所组成的矩阵. 重载+,*运算符时,可以在参数列表中传两个矩阵引 ...

  3. 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem G: Check The Check(模拟国际象棋)

    Problem G: Check The Check Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 10  Solved: 3[Submit][Statu ...

  4. 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 ...

  5. 【贪心+中位数】【新生赛3 1007题】 Problem G (K)

    Problem G Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Sub ...

  6. 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 ...

  7. Problem G: Keywords Search

    Problem G: Keywords SearchTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 10 Solved: 6[Submit][Status] ...

  8. BZOJ4977 八月月赛 Problem G 跳伞求生 set 贪心

    欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - BZOJ4977 - 八月月赛 Problem G 题意 小明组建了一支由n名玩家组成的战队,编号依次为1到n ...

  9. 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 ...

  10. ZOJ 4010 Neighboring Characters(ZOJ Monthly, March 2018 Problem G,字符串匹配)

    题目链接  ZOJ Monthly, March 2018 Problem G 题意  给定一个字符串.现在求一个下标范围$[0, n - 1]$的$01$序列$f$.$f[x] = 1$表示存在一种 ...

随机推荐

  1. 一张图告诉你移动Web前端所有技术(工程化、预编译、自动化)

    你要的移动web前端都在这里! 大前端方向:移动Web前端.Native客户端.Node.js. 大前端框架:React.Vue.js.Koa 跨终端技术:HTML5.CSS 3.JavaScript ...

  2. vue 父组件向子组件传递事件/调用事件

    方法一:子组件监听父组件发送的方法 方法二:父组件调用子组件方法 子组件: export default { mounted: function () { this.$nextTick(functio ...

  3. ThinkPHP中:RBAC权限控制的实习步骤

    使用版本ThinkPHP3.1.3 第一步,建表及数据 第二步,建关联模型 第三步,控制器使用关联模型.配置文件 第四步,模板显示数据 第一步,建表及数据 在数据库中,建立一个companysvn数据 ...

  4. java集合系列——List集合之Stack介绍(五)

    1.Stack的简介 Stack 类表示后进先出(LIFO)的对象堆栈.它通过五个操作对类 Vector 进行了扩展 ,允许将向量视为堆栈.它提供了通常的 push 和 pop 操作,以及取堆栈顶点的 ...

  5. 再起航,我的学习笔记之JavaScript设计模式27(链模式)

    链模式 概念介绍 链模式(Operatc of Responsibility): 通过在对象方法中将当前对象返回,实现对同一个对象多个方法的链式调用.从而简化对该对象的多个方法的多次调用时,对该对象的 ...

  6. Ansible(三) - playbook简介

    Ⅰ. Playbook介绍 Playbook其实就是ansible的一个任务列表,各任务按次序逐个在hosts中指定的所有主机上执行,即在所有主机上完成第一个任务后再开始第二个.在顺序运行某playb ...

  7. django celery的分布式异步之路(二) 高并发

    当你跑通了前面一个demo,博客地址:http://www.cnblogs.com/kangoroo/p/7299920.html,那么你的分布式异步之旅已经起步了. 性能和稳定性是web服务的核心评 ...

  8. curl命令用于模拟http浏览器发起动作

    1.模拟http浏览器发起访问百度首页的动作 curl  http://www.baidu.com 2.也可以模拟http浏览器发起POST动作,这个在测试后端程序时非常常见.

  9. NOIP初赛 之 逻辑运算

    NOIP初赛 之 逻辑运算 逻辑运算先掌握各种运算,注意运算符的级别比较,做题是要细心.在NOIP中一般一题,分值为1.5分. 概念介绍: 非:not  ¬      与:and ∧      或:o ...

  10. python re模块findall()详解

    今天写代码,在写到郑泽的时候遇到了一个坑,这个坑是re模块下的findall()函数. 下面我将结合代码,记录一下 import re string="abcdefg acbdgef abc ...