4534 2023. 03. 29 12:51:57 TomaSajt Világnaptár (45 pont) cpp17 Elfogadva 45/45 3ms 4036 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;
}
Részfeladat Összpont Teszt Verdikt Idő Memória
base 45/45
1 Elfogadva 0/0 3ms 1828 KiB
2 Elfogadva 0/0 3ms 2056 KiB
3 Elfogadva 0/0 3ms 2252 KiB
4 Elfogadva 2/2 2ms 2332 KiB
5 Elfogadva 2/2 3ms 2592 KiB
6 Elfogadva 3/3 3ms 2664 KiB
7 Elfogadva 3/3 3ms 2776 KiB
8 Elfogadva 3/3 2ms 2996 KiB
9 Elfogadva 3/3 3ms 3080 KiB
10 Elfogadva 3/3 3ms 3292 KiB
11 Elfogadva 3/3 3ms 3416 KiB
12 Elfogadva 3/3 3ms 3488 KiB
13 Elfogadva 3/3 3ms 3612 KiB
14 Elfogadva 3/3 3ms 3836 KiB
15 Elfogadva 3/3 3ms 3696 KiB
16 Elfogadva 3/3 3ms 3884 KiB
17 Elfogadva 3/3 3ms 3968 KiB
18 Elfogadva 2/2 3ms 3844 KiB
19 Elfogadva 3/3 3ms 4036 KiB