61682023-11-04 19:13:43MrChipserVilágnaptár (45 pont)cpp11Accepted 45/453ms4352 KiB
#include <iostream>

using namespace std;
int honapok1[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int honapok2[12]={31,30,30,31,30,30,31,30,30,31,30,30};
int main()
{
    int ev,ho,nap;
    cin >> ev >> ho >> nap;
    cout << ev << " ";
    int napok = 0;
    for(int i = 0; i < ho-1; i++)
    {
        if(i==1 && ev%4==0)
            napok+=29;
        else
            napok+=honapok1[i];
    }
    napok+=nap;
    int ujhonap = 1;
    for(int i = 0; i < 11; i++)
    {
        //cout << i << " " << napok << endl;
        if(i==5 && ev%4==0 && napok>31)
        {
            napok-=31;
            ujhonap++;
        }
        else if(i==5 && ev%4==0 && napok==31)
            break;
        else if(napok>honapok2[i])
        {
            napok-=honapok2[i];
            ujhonap++;
        }
        else
            break;
    }
    if(ev%4==0 && ujhonap==6 && napok==31)
    {
        cout << ujhonap << " " << "SZN";
    }
    else if(ujhonap==12 && napok==31)
    {
        cout << ujhonap << " " << "VN";
    }
    else
        cout << ujhonap << " " << napok;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/03ms1876 KiB
2Accepted0/03ms2124 KiB
3Accepted0/03ms2360 KiB
4Accepted2/23ms2504 KiB
5Accepted2/23ms2720 KiB
6Accepted3/33ms2936 KiB
7Accepted3/32ms3024 KiB
8Accepted3/33ms3028 KiB
9Accepted3/33ms3280 KiB
10Accepted3/33ms3632 KiB
11Accepted3/33ms3800 KiB
12Accepted3/32ms3888 KiB
13Accepted3/33ms3908 KiB
14Accepted3/33ms4124 KiB
15Accepted3/33ms4208 KiB
16Accepted3/32ms4128 KiB
17Accepted3/33ms4260 KiB
18Accepted2/23ms4348 KiB
19Accepted3/32ms4352 KiB