39522023-03-06 15:17:35kdbVilágnaptár (45 pont)cpp17Accepted 45/453ms4480 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <stack>
#include <deque>
#define ll long long
using namespace std;

ostream& operator<<(ostream& os, const vector<int>& input)
{
    for (auto const& i : input) {
        os << i << " ";
    }
    return os;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    const int r[13] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
    const int v[13] = { 0, 31, 61, 91, 122, 152, 182, 213, 243, 273, 304, 334, 364 };
    const int vSz[13] = { 0, 31, 61, 91, 122, 152, 182, 214, 244, 274, 305, 335, 365 };

    int ev, honap, nap;
    cin >> ev >> honap >> nap;

    int rNap = r[honap - 1] + nap;
    if (honap >= 3 and ev%4==0) rNap++; //szokőév

    int vEv = ev, vHonap = 0, vNap = 0;
    for (int i = 11; i >= 0; i--)
    {
        if (ev % 4 != 0 and v[i] < rNap)
        {
            vHonap = i + 1;
            vNap = rNap - v[i];
            break;
        }
        else if (ev % 4 == 0 and vSz[i] < rNap)
        {
            vHonap = i + 1;
            vNap = rNap - vSz[i];
            break;
        }
    }
    if (ev % 4 == 0 and vHonap == 7 and vNap == 1) cout << vEv << " " << vHonap - 1 << " SZN" << endl;
    else if (vHonap == 12 and vNap == 31) cout << vEv << " " << vHonap << " VN" << endl;
    else cout << vEv << " " << vHonap << " " << vNap << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/03ms2164 KiB
2Accepted0/02ms2152 KiB
3Accepted0/03ms2324 KiB
4Accepted2/22ms2532 KiB
5Accepted2/23ms2744 KiB
6Accepted3/32ms2952 KiB
7Accepted3/32ms3164 KiB
8Accepted3/32ms3380 KiB
9Accepted3/32ms3512 KiB
10Accepted3/33ms3720 KiB
11Accepted3/33ms3952 KiB
12Accepted3/33ms4172 KiB
13Accepted3/32ms4260 KiB
14Accepted3/32ms4260 KiB
15Accepted3/32ms4348 KiB
16Accepted3/33ms4244 KiB
17Accepted3/32ms4240 KiB
18Accepted2/22ms4480 KiB
19Accepted3/32ms4416 KiB