#include <stdio.h> using namespace std; int main(){ int h1,m1,s1; int h2,m2,s2; scanf("%d:%d:%d", &h1,&m1,&s1); scanf("%d:%d:%d", &h2,&m2,&s2); long long int sm1 = h1*3600+m1*60+s1; long long int sm2 = h2*3600+m2*60+s2; long long int sm3 = sm2 - sm1; if( sm3<0 ){ sm3 = -sm3; } int hour = sm3/3600; int minute = (sm3-hour*3600)/60; int second = sm3%60%60%60; printf("%02d:%02d:%02d", hour, minute,second); return 0; } |
Double click to view unformatted code.