http://lx.lanqiao.cn/problem.page?gpid=T2723http://lx.lanqiao.cn/problem.page?gpid=T2723
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int get_second(int h,int m,int s)//将时间转化为秒
{
return h*3600+m*60+s;
}
int get_time()
{
string line;
getline(cin,line);
if(line.back()!=')') line+="(+0)";//统一格式
int h1,m1,s1,h2,m2,s2,d;
sscanf(line.c_str(),"%d:%d:%d %d:%d:%d (+%d)",&h1,&m1,&s1,&h2,&m2,&s2,&d);//分离出小时,分钟和秒
return get_second(h2,m2,s2)-get_second(h1,m1,s1)+d*86400;//返回来回时间的差值
}
int main()
{
int n;
cin>>n;
string line;
getline(cin,line);
while(n--)
{
int time1=get_time(),time2=get_time();
int t=(time1+time2)/2;
printf("%02d:%02d:%02d\n",t/3600,t%3600/60,t%60);
}
return 0;
}