src2020/time/timecin.cpp

24 lines
489 B
C++

#include <iostream>
using namespace std;
int main()
{
long long anss, ansf, chus = 0, chuf = 0;
int s, f;
cin >> anss >> ansf;
while (cin >> s >> f) {
chuf += ansf - f;
if (chuf < 0) {
chus--;
chuf += 60;
}
if (chuf > 59) {
chus++;
chuf -= 60;
}
chus += anss - s;
}
cout << chus << ":";
if (chuf < 10)
cout << "0";
cout << chuf;
}