2 1 2 3 4 5 6 34 45 56 12 23 34
5 7 9 47 9 30
#include <iostream> using namespace std; typedef struct _time { int h; int m; int s; }Time; Time operator+(Time &l, Time &r) { Time t; t.s = l.s + r.s; t.m = l.m + r.m + t.s / 60; t.s %= 60; t.h = l.h + r.h + t.m / 60; t.m %= 60; return t; } ostream& operator<< (ostream &os, Time &v) { os << v.h << " " << v.m << " " << v.s; return os; } istream& operator>>(istream &is, Time &v) { is >> v.h >> v.m >> v.s; return is; } int main() { int n; cin >> n; Time l, r; while(n--) { cin >> l >> r; Time s = l + r; cout << s << endl; } return 0; }