45342023-03-29 12:51:57TomaSajtVilágnaptár (45 pont)cpp17Accepted 45/453ms4036 KiB
#include <bits/stdc++.h>
using namespace std;
#define speed cin.tie(0); ios::sync_with_stdio(0)

vector<int> orig_month_lengths = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
vector<int> new_month_lengths = { 31, 30, 30, 31, 30, 30, 31, 30, 30, 31, 30, 31 };

int main() {
    speed;
    int year, month_ind, month_day_ind;
    cin >> year >> month_ind >> month_day_ind;
    month_day_ind--;
    month_ind--;
    if (year % 4 == 0) {
        orig_month_lengths[1]++;
        new_month_lengths[5]++;
    }
    int day_index = month_day_ind;
    for (int i = 0; i < month_ind; i++) {
        day_index += orig_month_lengths[i];
    }
    int new_month_ind = 0;
    while (day_index >= new_month_lengths[new_month_ind]) {
        day_index -= new_month_lengths[new_month_ind];
        new_month_ind++;
    }
    int new_month_day_index = day_index;
    cout << year << ' ' << new_month_ind + 1 << ' ';
    if (new_month_ind == 5 && new_month_day_index == 30) cout << "SZN";
    else if (new_month_ind == 11 && new_month_day_index == 30) cout << "VN";
    else cout << new_month_day_index + 1;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/03ms1828 KiB
2Accepted0/03ms2056 KiB
3Accepted0/03ms2252 KiB
4Accepted2/22ms2332 KiB
5Accepted2/23ms2592 KiB
6Accepted3/33ms2664 KiB
7Accepted3/33ms2776 KiB
8Accepted3/32ms2996 KiB
9Accepted3/33ms3080 KiB
10Accepted3/33ms3292 KiB
11Accepted3/33ms3416 KiB
12Accepted3/33ms3488 KiB
13Accepted3/33ms3612 KiB
14Accepted3/33ms3836 KiB
15Accepted3/33ms3696 KiB
16Accepted3/33ms3884 KiB
17Accepted3/33ms3968 KiB
18Accepted2/23ms3844 KiB
19Accepted3/33ms4036 KiB