飞行时长:(时差1+时差2) / 2
时差:两次互相飞的终点时间减去起始时间之差
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = Integer.parseInt(sc.nextLine());
while (n -- > 0) {
int time = (getTime() + getTime()) / 2;
int hour = time / 3600, minute = time % 3600 / 60, second = time % 60;
System.out.printf("%02d:%02d:%02d\n", hour, minute, second);
}
}
static int getSeconds(int h, int m, int s) {
return s + m * 60 + h * 3600;
}
static int getTime() {
String[] str = sc.nextLine().split(" ");
int d = 0;
if (str.length != 2) d = str[2].charAt(2) - '0';
int[] arr = new int[2];
for (int i = 0; i < 2; i++) {
String[] string = str[i].split(":");
int h = toInt(string[0]), m = toInt(string[1]), s = toInt(string[2]);
arr[i] = getSeconds(h, m, s);
}
return arr[1] - arr[0] + d * 24 * 3600;
}
static int toInt(String str) {
return Integer.parseInt(str);
}
}