0
已解决
题目链接: 酷町堂:7437
各位大佬们帮忙看一下,这题卡了一星期
#include<bits/stdc++.h>
using namespace std;
int h1,m1,s1,h2,m2,s2,cnt;
long long x1,x2; char x;
int main(){
cin>>h1>>x>>m1>>x>>s1>>h2>>x>>m2>>x>>s2;
x1=h1*3600+m1*60+s1;
x2=h2*3600+m2*60+s2;
if(x2<=x1){
cnt+=(86400-x1);
cnt+=x2;
}else{
cnt=h2-h1;
}
int a,b,c;
a=cnt/3600;
b=cnt/60%60;
c=cnt%60;
if(a<10){
if(b<10){
if(c<10){
cout<<0<<a<<":"<<0<<b<<":"<<0<<c;
}else{
cout<<0<<a<<":"<<0<<b<<":"<<c;
}
}else{
cout<<0<<a<<":"<<b<<":"<<c;
} else if(b<10){
if(c<10){
cout<<a<<":"<<0<<b<<":"<<0<<c;
}else{
cout<<a<<":"<<0<<b<<":"<<c;
}
}else if(c<10){
cout<<a<<":"<<b<<":"<<0<<c;
}else{
cout<<a<<":"<<b<<":"<<c;
}
return 0;
}