#include<stdio.h> #include<ctype.h> #include<string.h> #include<iostream> #include<stack> #include<time.h> #include<math.h> using namespace std; /*test*/ //#define as '\x41' //int atoi(char s[]); //int strlen(char s[]); //void squeeze(char s[], char c); //void strcat(char s[], char t[]); //int bitcount(unsigned x); int main() { int x1, x2, x3; int y1, y2, y3; scanf("%d:%d:%d", &x1, &x2, &x3); scanf("%d:%d:%d", &y1, &y2, &y3); int z1, z2, z3; z1 = x1 * 3600 + x2 * 60 + x3; z2 = y1 * 3600 + y2 * 60 + y3; z3 = abs(z1 - z2); int a, b, c; a = z3 / 3600; b = (z3 - a * 3600) / 60; c = z3 - a * 3600 - b * 60; printf("%d:", a); if (b == 0)printf("00:"); else if (b > 0 && b < 10)printf("0%d:", b); else printf("%b:", a); if (c == 0)printf("00"); else if (c > 0 && c < 10)printf("0%d", c); else printf("%d", c); } |
Double click to view unformatted code.