너무 하드코딩이다......
#include<iostream>
#include<vector>
void Itot(int h,int j, int i)
{
int result = h * 10000 + j * 100 + i;
int a, b, c;
c = result % 100;
result /= 100;
b = result % 100;
a = result / 100;
if (a < 10)
std::cout << 0;
std::cout << a << ":";
if (b < 10)
std::cout << "0";
std::cout << b << ":";
if (c < 10)
std::cout << "0";
std::cout<< c;
}
int main()
{
int a, b, c;
int d, e, f;
int h=24, i=00, j=00;
scanf_s("%d:%d:%d", &a, &b, &c);
scanf_s("%d:%d:%d", &d, &e, &f);
int result;
int tmp1 = a * 10000 + b * 100 + c, tmp2 = d * 10000 + e * 100 + f;
if (tmp1>tmp2)
{
result = 240000 - tmp1 + tmp2;
h += d;
i += e;
j += f;
h -= a;
i -= b;
j -= c;
if (j < 0)
{
j += 60;
i--;
}
if (i < 0)
{
i += 60;
h--;
}
Itot(h, i, j);
}
else
{
d -= a;
e-= b;
f-= c;
if (f < 0)
{
f += 60;
e--;
}
if (e < 0)
{
e += 60;
d--;
}
Itot(d,e,f);
}
}