39512023-03-06 15:16:58kdbA lehető legkevesebb átszállás (50 pont)cpp17Wrong answer 0/503ms4828 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
base0/50
1Wrong answer0/03ms1764 KiB
2Runtime error0/03ms2100 KiB
3Wrong answer0/13ms2144 KiB
4Wrong answer0/13ms2512 KiB
5Wrong answer0/22ms2492 KiB
6Wrong answer0/23ms2620 KiB
7Runtime error0/23ms2812 KiB
8Runtime error0/23ms3204 KiB
9Runtime error0/23ms3444 KiB
10Runtime error0/23ms3420 KiB
11Runtime error0/23ms3620 KiB
12Runtime error0/23ms3528 KiB
13Runtime error0/23ms3780 KiB
14Runtime error0/23ms3904 KiB
15Runtime error0/23ms3900 KiB
16Runtime error0/23ms3908 KiB
17Runtime error0/23ms3736 KiB
18Runtime error0/23ms3868 KiB
19Runtime error0/23ms4140 KiB
20Runtime error0/23ms4220 KiB
21Runtime error0/23ms4484 KiB
22Runtime error0/23ms4316 KiB
23Runtime error0/23ms4448 KiB
24Runtime error0/23ms4576 KiB
25Runtime error0/23ms4576 KiB
26Runtime error0/23ms4828 KiB
27Runtime error0/23ms4656 KiB
28Runtime error0/23ms4788 KiB