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