#include<stdio.h> #include<string.h> #include<math.h> int main() { int h1,m1,s1; int h2,m2,s2; scanf("%d:%d:%d",&h1,&m1,&s1); scanf("%d:%d:%d",&h2,&m2,&s2); int t1=s1+m1*60+h1*60*60; int t2=s2+m2*60+h2*60*60; int cha=abs(t1-t2); int temp=cha; int h=temp/(60*60); temp=cha; int m=(temp-h*60*60)/60; temp=cha; int s=temp-h*60*60-m*60; printf("%d:%02d:%02d\n",h,m,s); return 0; } |
Double click to view unformatted code.