#define _CRT_SECURE_NO_DEPRECATE #include <iostream> #include<stdio.h> #include<string> #include<string.h> using namespace std; int main() { int a, b, c; int d, e, f; scanf("%d:%d:%d", &a, &b, &c); scanf("%d:%d:%d", &d, &e, &f); int sum1, sum2, sum; sum1 = 3600 * a + 60 * b + c; sum2 = 3600 * d + 60 * e + f; sum = abs(sum1 - sum2); int x, y, z; x = sum / 3600; y = sum % 3600 / 60; z = sum % 60; printf("%d:%02d:%02d", x, y, z); } |
Double click to view unformatted code.