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. 微信支付之h5方式(非微信内置浏览器中支付)

    这两天完成了公司网站手机和PC端的支付对接,就是支付宝和微信. 对接完后有所感触,我们来聊一聊,微信支付的坑,为什么这么说呢,因为我在对接完支付宝后是很愉快的,基本上在demo上稍加修改就ok了, 对 ...

  2. 宝藏(树形DP)

      这道题目是十分考验思维的,n^2应该还是比较好想的,主要是如何转移根的问题.转移根,在我看来应该是树形dp最难的一部分了, 一般学会如何转移根,也就差不多考验通吃树形dp了. 下面转一转大佬链接: ...

  3. 跨主机使用 Rex-Ray volume - 每天5分钟玩转 Docker 容器技术(77)

    上一节我们在 docker1 上的 MySQL 容器中使用了 Rex-Ray volume mysqldata,更新了数据库.现在容器已经删除,今天将演示在 docker2 中重新使用这个卷. 在 d ...

  4. Elixir游戏服设计六

    接上章,我新建了个app做包含Table模型, TableServer等.Table桌子的代码暂时如下, 有一些状态还没用上 defmodule Table do @state_accept 0 #准 ...

  5. webservice接口国内手机号码归属地查询

    操作步骤: 1.打开eclipse,新建web工程MobileCodeClient 2.打开运行窗口 右击工程名选择properties 切换到运行窗口,按图切换到相应的目录里 执行命令: wsdl2 ...

  6. 【转】Wi-Fi 20mhz 和 40mhz 频段带宽的区别是什么?

    一.无线网卡模式 wifi现在市场上主要存在802.11a/b/g/n/ac五种模式的无线网卡: 1.b的最大速率11Mbps,频段2.4G,带宽22M: 2.a的最大速率54Mbps,频段5G,带宽 ...

  7. HDU1421搬寝室(简单DP)

    当然,还可以加滚动数组优化. #include<cstdio> #include<cstdlib> #include<iostream> #include<m ...

  8. ZOJ1181 Word Amalgamation 字符串 排序查找

    传送门:ZOJ1181  思路:自身排序来判断两个字符串拥有相同的字符.   #include<cstdio> #include<cstdlib> #include<io ...

  9. IDL 创建数组

    1.赋值创建 通过方括号[]赋值创建数组,示例代码如下 IDL> arr=[1,2,3] IDL> help,arr ARR INT = Array[3] IDL> arr=[[1, ...

  10. Jquery实现弹出选择框选择后返回,支持多级分类

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...