79892024-01-12 09:42:59BotiVilágnaptár (45 pont)cpp17Accepted 45/453ms3980 KiB
#include <bits/stdc++.h>

using namespace std;

vector<int> napok = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
vector<int> napok1 = {0, 31, 61, 91, 122, 152, 182, 213, 243, 273, 304, 334, 365};
vector<int> napok2 = {0, 31, 61, 91, 122, 152, 183, 214, 244, 274, 305, 335, 366};

int main()
{
    int y, m, d;
    cin >> y >> m >> d;
    int d1 = napok[m -1] + d;
    if (y % 4 == 0 && m > 2)
        d1++;
    int m1 = 12;
    for (int i = 1; i <= 12; i++)
    {
        if (y % 4 == 0)
        {
            if (napok2[i] >= d1)
            {
                m1 = i;
                d1 -= napok2[i -1];
                i = 12;
            }
        }
        else
        {
            if (napok1[i] >= d1)
            {
                m1 = i;
                d1 -= napok1[i -1];
                i = 12;
            }
        }
    }
    if (y % 4 == 0 && m1 == 6 && d1 == 31)
        cout << y << " 6 SZN";
    else if (m1 == 12 && d1 == 31)
        cout << y << " 12 VN";
    else
        cout << y << " " << m1 << " " << d1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/03ms1816 KiB
2Accepted0/03ms2052 KiB
3Accepted0/03ms2288 KiB
4Accepted2/23ms2500 KiB
5Accepted2/23ms2756 KiB
6Accepted3/32ms2680 KiB
7Accepted3/33ms2676 KiB
8Accepted3/33ms2772 KiB
9Accepted3/33ms2900 KiB
10Accepted3/33ms3108 KiB
11Accepted3/33ms3328 KiB
12Accepted3/33ms3540 KiB
13Accepted3/33ms3648 KiB
14Accepted3/33ms3624 KiB
15Accepted3/33ms3732 KiB
16Accepted3/33ms3864 KiB
17Accepted3/33ms3832 KiB
18Accepted2/22ms3952 KiB
19Accepted3/33ms3980 KiB