1.1007
2.
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.
2[bk]12.5 [bk][bk]5[bk]0:23:21[bk]0:25:01 [bk]42[bk]0:23:32[bk]-:--:-- [bk][bk]7[bk]0:33:20[bk]0:41:35
[bk][bk]5:[bk]3:52[bk]min/km [bk]42:[bk]- [bk][bk]7:[bk]6:00[bk]min/km
3.
计算各个接力队的平均速度。输入的第一个数N意思是比赛的节数,第二个数D 为赛道的距离,单位是千米。第二行第一个数是队伍编号,这个没有什么意义,照着输出就行了,后面是一个以h:mm:ss格式表示的时间,以空格分隔,意为这个队伍完成这一小节比赛所消耗的时间,把所有的时间加起来就是这个队跑完全程(也就是上面输入的D)所用的总时间。对于每一组输入数据,输出这个队伍的平均速度,单位是min/km(**参考异常网)
4.
1、输入编号的候用%3d,否则前面的空格就会把输入搞乱了
2、把h:mm:ss的时间当做字符串输入,放在一个char数组中,用 strtok把里面的数字分离
3、把单位换算成 m:ss,min/km,即跑一千米用多少时间
4、计算结果的过程中注意要四舍五入,不能全部用整形
5、输出结果时,注意当秒数只有1位数的时候要在前面补0(不能出现4:8这种格式)
5.
#include <cstdio>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<math.h>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<iomanip>
using namespace std;
int main()
{
//freopen("r.txt", "r", stdin);
int n,t,h,m,s,i,sum;
char arr[100];
double d;
cin>>n>>d;
while(~scanf("%d",&t))
{
int work=sum=0;
for(i=0;i<n;i++)
{
if(scanf("%d:%d:%d",&h,&m,&s)==3)
{
sum+=h*3600+m*60+s;
}
else
{
gets(arr);
work=1;
break;
}
}
if(work)
{
cout<<setw(3)<<t<<": -"<<endl;
}
else
{
sum=sum/d+0.5;
cout<<setw(3)<<t<<": "<<sum/60<<":";
if((sum%60)<10)
cout<<0;
cout<<sum%60<<" min/km"<<endl;
}
}
}