45342023-03-29 12:51:57TomaSajtVilágnaptár (45 pont)cpp17Elfogadva 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;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base45/45
1Elfogadva0/03ms1828 KiB
2Elfogadva0/03ms2056 KiB
3Elfogadva0/03ms2252 KiB
4Elfogadva2/22ms2332 KiB
5Elfogadva2/23ms2592 KiB
6Elfogadva3/33ms2664 KiB
7Elfogadva3/33ms2776 KiB
8Elfogadva3/32ms2996 KiB
9Elfogadva3/33ms3080 KiB
10Elfogadva3/33ms3292 KiB
11Elfogadva3/33ms3416 KiB
12Elfogadva3/33ms3488 KiB
13Elfogadva3/33ms3612 KiB
14Elfogadva3/33ms3836 KiB
15Elfogadva3/33ms3696 KiB
16Elfogadva3/33ms3884 KiB
17Elfogadva3/33ms3968 KiB
18Elfogadva2/23ms3844 KiB
19Elfogadva3/33ms4036 KiB