| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
贴一下AC代码#include <stdio.h>
#include <cmath>
#include <cstring>
int T[5];
int calc()
{
double a = (double)(T[4] - T[1]) / (T[2] - T[1]);
double b = (double)(T[2] - T[0]) / (T[3] - T[0]);
double res = (a - 1) / (a * b - 1) * (T[1] - T[0]);
return (int)floor(res + T[0] + 0.5);
}
int main()
{
while (true) {
for (int i = 0; i < 5; ++i) {
int h, m, s;
if (scanf_s("%d:%d:%d", &h, &m, &s) < 3) {
return 0;
}
T[i] = h * 3600 + m * 60 + s;
}
int res = calc();
printf("%02d:%02d:%02d\n", res / 3600, res % 3600 / 60, res % 60);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator