Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: mfs
Problemset: Journey of Love
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-08 17:10:16
#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool leap(int y) {
if (y%400 == 0 || (y%4 == 0 && y%100 != 0)) return true;
else return false;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int months[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
int Y,M,D,H,MI,S,q; cin >> Y >> M >> D >> H >> MI >> S >> q;
while (q--) {
ll y,m,d,h,mi,s; cin >> s;
s += S;
mi = MI + s/60;
s %= 60;
h = H + mi/60;
mi %= 60;
d = D + h/24;
h %= 24;
y = Y; m = M;
while (true) {
int days = months[m-1];
if (leap(y) && m == 2) days++;
if (d <= days) break;
d -= days;
m++;
if (m == 13) m = 1, y++;
}
cout << y << ' ' << m << ' ' << d << ' ' << h << ' ' << mi << ' ' << s << '\n';
}
}