#include<stdio.h> int main() { int h,m,s; int h1,m1,s1; int h2,m2,s2; int x1,x2; scanf("%d:%d:%d",&h,&m,&s); scanf("%d:%d:%d",&h1,&m1,&s1); x1=s+m*60+h*60*60; x2=s1+m1*60+h1*60*60; if(x1>x2){ int t=x1-x2; h2=t/3600; m2=t/60%60; s2=t%60; if(m2<10){ printf("%d:0%d:%d",h2,m2,s2); }else{ printf("%d:%d:%d",h2,m2,s2); } }else{ int t=x2-x1; h2=t/3600; m2=t/60%60; s2=t%60; if(m2<10){ printf("%d:0%d:%d",h2,m2,s2); }else{ printf("%d:%d:%d",h2,m2,s2); } } return 0; } |
Double click to view unformatted code.