75602024-01-09 16:56:02AblablablaEgykorúak (75 pont)cpp17Accepted 75/759ms4272 KiB
#include <bits/stdc++.h>

using namespace std;

vector<int> honapok = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};

int main()
{
    int n;
    cin >> n;

    int peti = 0;
    int ev, honap, nap;
    cin >> ev >> honap >> nap;
    ev -= 1948;
    if(ev % 4 == 0){
        peti += ev / 4 - (honap <= 2 ? 1 : 0);
    } else{
        peti += ev / 4;
    }

    peti += 365 * ev + honapok[honap - 1] + nap;

    int valasz = 0;

    for(int i = 0; i < n; i++){
        int akt = 0;
        cin >> ev >> honap >> nap;

        ev -= 1948;
        if(ev % 4 == 0){
            akt += ev / 4 - (honap <= 2 ? 1 : 0);
        } else{
            akt += ev / 4;
        }

        akt += 365 * ev + honapok[honap - 1] + nap;

        if(abs(peti - akt) <= 365){
            valasz++;
        }
    }

    cout << valasz << "\n";
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1848 KiB
2Accepted0/09ms2220 KiB
3Accepted5/53ms2400 KiB
4Accepted5/53ms2544 KiB
5Accepted5/53ms2752 KiB
6Accepted5/53ms2872 KiB
7Accepted5/53ms3124 KiB
8Accepted5/53ms3204 KiB
9Accepted5/53ms3436 KiB
10Accepted5/54ms3708 KiB
11Accepted5/54ms3736 KiB
12Accepted5/54ms3656 KiB
13Accepted5/56ms3788 KiB
14Accepted5/56ms3880 KiB
15Accepted5/57ms4120 KiB
16Accepted5/58ms4136 KiB
17Accepted5/58ms4272 KiB