70672023-12-29 11:03:16MagyarKendeSZLGEgykorúak (75 pont)cpp17Accepted 75/7528ms3564 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)

using namespace std;

const int N_lengthS[13] = {
    0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

const int S_lengthS[13] = {
    0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

int days(int e, int h, int n) {
    for (int i = 1; i < e; i++) {
        n += (i % 4 ? 365 : 366);
    }
    if (e % 4) {
        for (int i = 1; i < h; i++) {
            n += N_lengthS[i];
        }
    } else {
        for (int i = 1; i < h; i++) {
            n += S_lengthS[i];
        }
    }
    return n;
}

int main() {
    speed;

    int M, E, H, N, D, result = 0;
    cin >> M >> E >> H >> N;
    
    D = days(E, H, N);

    while (M--) {
        int FE, FH, FN;
        cin >> FE >> FH >> FN;

        result += (abs(days(FE, FH, FN) - D) <= 365);
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms2168 KiB
2Accepted0/028ms2224 KiB
3Accepted5/53ms2588 KiB
4Accepted5/53ms2528 KiB
5Accepted5/53ms2624 KiB
6Accepted5/53ms2600 KiB
7Accepted5/53ms2784 KiB
8Accepted5/53ms3192 KiB
9Accepted5/53ms3068 KiB
10Accepted5/58ms3120 KiB
11Accepted5/58ms3124 KiB
12Accepted5/59ms3120 KiB
13Accepted5/513ms3124 KiB
14Accepted5/514ms3116 KiB
15Accepted5/517ms3348 KiB
16Accepted5/520ms3456 KiB
17Accepted5/525ms3564 KiB