1231. 航班时间
题目链接https://www.acwing.com/problem/content/1233/
题目:
思路:
#include<iostream>
#include<cstdio>
using namespace std;
int n;
int get_time(){
int a,b,c,d,e,f,g=0;
scanf("%d:%d:%d",&a,&b,&c);
scanf("%d:%d:%d",&d,&e,&f);
if(getchar()!='\n'){
scanf("(+%d)",&g);
}
int st=a*60*60+b*60+c;
int ed=d*60*60+e*60+f+24*60*60*g;
return ed-st;
}
int main(){
cin>>n;
while(n--){
int sum=(get_time()+get_time())/2;
printf("%02d:%02d:%02d\n",sum/3600,sum%3600/60,sum%60);
}
return 0;
}
之前写的代码https://blog.csdn.net/weixin_46028214/article/details/112854216
蓝桥杯日期问题汇总https://blog.csdn.net/weixin_46028214/article/details/115734205