#include<stdio.h> #include<math.h> int main() { int h1,h2,h; int m1,m2,m; int s1,s2,s; scanf("%d:%d:%d",&h1,&m1,&s1); scanf("%d:%d:%d",&h2,&m2,&s2); int se1=h1*3600+m1*60+s1; int se2=h2*3600+m2*60+s2; int c=fabs(se1-se2); h=c/3600; m=c%3600/60; s=c%3600%60; printf("%d:%02d:%02d",h,m,s); return 0; } |
Double click to view unformatted code.