187342025-11-01 12:38:34PKBEgykorúak (75 pont)cpp17Wrong answer 40/758ms500 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
#include <cstdint>
using namespace std;

int days_from_start(int year, int month, int day, vector<int> honapok) {
    int days = 0;
    for(int y = 1950; y < year; y++) {
        days += 365 + (y % 4 == 0 ? 1 : 0); 
    }
    if (year % 4 == 0) honapok[1] = 29; //szökőév február
    for(int m = 0; m < month-1; m++) {
        days += honapok[m];
    }
    days += day;
    return days;
} //ez a function átváltja az életkorukat napokba és használhatod hogy napra pontosan megnézd a életkort
//days_from_start(év, hónap, nap, és a honapok vektor)  AMIT EN IRTAM AZ JO A PREFIXEL? nézem

int main() {
    int N;
    cin >> N;
    int temp;
    int nap;
    vector<int> honapok(12);
    honapok[0] = 31;
    honapok[1] = 28;
    honapok[2] = 31;
    honapok[3] = 30;
    honapok[4] = 31; 
    honapok[5] = 30;
    honapok[6] = 31;
    honapok[7] = 31;
    honapok[8] = 30;
    honapok[9] = 31;
    honapok[10] = 30;
    honapok[11] = 31;
    int temp1;
    int temp2;
    int temp3;
    vector<int> napok(N);
    for(int i = 0; i < N; i++ ){
        cin >> temp1;
        cin >> temp2;
        cin >> temp3;

        napok[i] = days_from_start(temp1, temp2, temp3, honapok);
    }


    int peti = napok[0];

    int megoldas = 0;


    for(int i = 1; i <= N; i++){

        if (abs(peti - napok[i]) <= 365) {
            megoldas++;
        }

    }

    cout << megoldas;
}
SubtaskSumTestVerdictTimeMemory
base40/75
1Accepted0/01ms316 KiB
2Accepted0/08ms500 KiB
3Wrong answer0/51ms316 KiB
4Accepted5/51ms316 KiB
5Wrong answer0/52ms316 KiB
6Wrong answer0/51ms316 KiB
7Wrong answer0/51ms316 KiB
8Accepted5/51ms316 KiB
9Wrong answer0/51ms316 KiB
10Wrong answer0/52ms316 KiB
11Accepted5/53ms404 KiB
12Accepted5/53ms316 KiB
13Accepted5/54ms316 KiB
14Accepted5/54ms392 KiB
15Accepted5/56ms316 KiB
16Accepted5/56ms424 KiB
17Wrong answer0/58ms316 KiB