Description
Tom is the most handsome CCPC contestant in HIT.Tom has a PE exam. So he must run 2400 meters. As we all know, one circle of runways is400 meters. So Tom must run 6 circles of runways. And each time Tom finish one circle ofrunways, Tom can know the time from which he started running. Although Tom is tired to finishthe exam, he still wants to know the average time he used per circle.So could you tell him the answer? (Unit uses meters per second. Round the answer up tothe nearest integer.)
Input
First line contains an integer T (1 ≤ T ≤ 6), represents there are T test cases.Each test case has 6 lines.The line i contains only one string formatting a i :b i :c i represents the time he gets when hefinishes the i_th circle of runways. (0 ≤ a i , b i , c i ≤ 59) (Tom’s speed is far less than the light speed)
Output
For each test case, output one line containing an integer.
![](/qrcode.jpg)
Sample Input 1
2 00:02:00 00:04:00 00:08:00 00:10:00 00:12:00 00:14:00 00:00:50 00:01:30 00:03:00 00:05:00 00:09:00 01:59:59
Sample Output 1
3 0
题意:汤姆是HIT最帅的CCPC选手.Tom有一个体育考试。 所以他必须跑2400米。
众所周知,一圈跑道是400米。 所以汤姆必须跑6圈跑道。 每当汤姆完成一圈跑道时,汤姆就能知道他开始跑步的时间。
虽然汤姆已经厌倦了完成考试,但他仍然想知道他每圈使用的平均时间。
所以你能告诉他答案吗? (单位使用每秒米数。将答案四舍五入到最接近的整数。)
题解:该题每组六个数据,实则每次读取最后一个数据,转化为s,因为题目要求单位使用每秒米数,
总路程除以总秒数即可,当然,要四舍五入,如样例一:第6个数为00:14:00,转化成s,14*60=840;2400/840四舍五入后为3;
#include<cstdio> #include<iostream> using namespace std; int main() { int t,n; int a[60],b[60],c[60]; cin>>t; while(t--) { for(int i=1;i<=6;i++) scanf("%d:%d:%d",&a[i],&b[i],&c[i]); int sum=a[6]*3600+b[6]*60+c[6]; double n=2400/(sum*1.0); int x=n*10; if(x%10>=5) printf("%d\n",2400/sum+1); else printf("%d\n",2400/sum); } return 0; }