17762022-12-02 22:28:42kdbEgykorúak (75 pont)cpp11Accepted 75/754ms3820 KiB
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int x[] = { 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
int d(int e, int h, int n)
{
    int s = e * 365 + floor(e / 4);
    s += x[h - 1];
    if (e % 4 == 0 && h < 3 && !(h == 2 && n == 29)) s--;
    s += n;
    return s;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n, q, w, e, m = 0, p;
    cin >> n >> q >> w >> e;
    p = d(q, w, e);
    while (n--)
    {
        int a, b, c;
        cin >> a >> b >> c;
        if (abs(p - d(a, b, c)) <= 365) m++;
    }
    cout << m << endl;
    return 0;
}
/*
4
2003 12 1
2001 1 1
2003 5 21
2002 12 1
2004 12 1
-2
*/
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1892 KiB
2Accepted0/04ms2084 KiB
3Accepted5/52ms2312 KiB
4Accepted5/52ms2488 KiB
5Accepted5/52ms2724 KiB
6Accepted5/52ms2956 KiB
7Accepted5/52ms3176 KiB
8Accepted5/52ms3220 KiB
9Accepted5/52ms3212 KiB
10Accepted5/53ms3340 KiB
11Accepted5/53ms3440 KiB
12Accepted5/53ms3488 KiB
13Accepted5/53ms3484 KiB
14Accepted5/53ms3512 KiB
15Accepted5/54ms3608 KiB
16Accepted5/54ms3820 KiB
17Accepted5/54ms3792 KiB