AcWing 1363. New Online Judge 1363: [蓝桥杯2018初赛]航班时间
原题链接
简单
作者:
史一帆
,
2021-03-28 21:00:07
,
所有人可见
,
阅读 582
C语言的输入与输出
#include <stdio.h>
int get_time()
{
int h1, m1, s1, h2, m2, s2;
scanf("%d:%d:%d %d:%d:%d", &h1, &m1, &s1, &h2, &m2, &s2);
int day = 0;
if ((getchar()) != '\n') scanf("(+%d)", &day);
int f = h1 * 3600 + m1 * 60 + s1;
int s = h2 * 3600 + m2 * 60 + s2;
return s - f + day * 24 * 3600;
}
int main()
{
int n;
scanf("%d", &n);
while (n --)
{
int ans = (get_time() + get_time()) / 2;
printf("%02d:%02d:%02d\n", ans / 3600, ans / 60 % 60, ans % 60);
}
return 0;
}