Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int d, h, m, cur_d;
- cin >> d >> h >> m;
- cur_d = d;
- int t = m + h * 60 + (d - 1) * 24 * 60;
- int n;
- cin >> n;
- int minn = 1e9;
- for (int i = 0; i < n; ++i) {
- cin >> d >> h >> m;
- if (d == 0) {
- int time = m + h * 60 + (cur_d - 1) * 24 * 60;
- if (time < t) {
- time += 24 * 60;
- }
- minn = min(minn, time);
- }
- else {
- int time = m + h * 60 + (d - 1) * 24 * 60;
- if (time < t) {
- time += 7 * 24 * 60;
- }
- minn = min(minn, time);
- }
- }
- d = minn / (24 * 60) % 7 + 1;
- h = minn % (24 * 60) / 60;
- m = minn % 60;
- cout << d << " " << h << " " << m;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment