9382022-01-29 16:23:13HorakZsofiEgykorúak (75 pont)cpp11Accepted 75/758ms2384 KiB
#include <bits/stdc++.h>
using namespace std;

int ho[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int napvaltas(int ev, int honap, int nap){
int valasz=0;
for(int i=1950; i<ev; i++){
  if(i%4==0){
    valasz+=366;
  }
  else{valasz+=365;}
}
for(int i=0; i<honap-1; i++){
  valasz+=ho[i];
}
valasz+=nap;
if(ev%4==0 && honap>2){
valasz++;
}
 return valasz;
}

int main() {
 int n;
 cin>>n;
 int petiev,petihonap,petinap;
 cin>>petiev>>petihonap>>petinap;
 int petivalt=napvaltas(petiev, petihonap, petinap);
 int szaml=0;
 for(int i=0; i<n; i++){
   int ev, honap, nap;
   cin>>ev>>honap>>nap;
   int valt=napvaltas(ev,honap,nap);
   if(petivalt+365>=valt && petivalt-365<=valt){
szaml++;
   }
 } 
 cout<<szaml;
 return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms1800 KiB
2Accepted0/08ms1976 KiB
3Accepted5/51ms2020 KiB
4Accepted5/51ms2024 KiB
5Accepted5/51ms2024 KiB
6Accepted5/51ms2036 KiB
7Accepted5/51ms2040 KiB
8Accepted5/51ms2036 KiB
9Accepted5/51ms2044 KiB
10Accepted5/53ms2048 KiB
11Accepted5/52ms2076 KiB
12Accepted5/53ms2104 KiB
13Accepted5/54ms2140 KiB
14Accepted5/54ms2184 KiB
15Accepted5/54ms2240 KiB
16Accepted5/56ms2312 KiB
17Accepted5/58ms2384 KiB