http://acm.hit.edu.cn/hoj/problem/view?id=2546
t2和t3是正确时间 t1和t4计算间隔
走回家用的时间是去的两倍
#include <stdio.h>
struct time
{
int hour;
int minute;
}t1, t2, t3, t4, arrive;
int main()
{
int delta, total;
double t;
while (scanf("%d:%d %d:%d %d:%d %d:%d", &t1.hour, &t1.minute, &t2.hour, &t2.minute, &t3.hour, &t3.minute, &t4.hour, &t4.minute) != EOF)
{
delta = (t3.hour - t2.hour) * 60 + (t3.minute - t2.minute);
total = (t4.hour - t1.hour) * 60 + (t4.minute - t1.minute);
t = 2 * (total - delta) / 3;
arrive.hour = t3.hour + (int)(t+0.5) / 60;
arrive.minute = t3.minute + (int)(t+0.5) % 60;
printf("%d:%02d\n", arrive.hour, arrive.minute);
}
return 0;
}