113072024-08-07 21:01:55bzyEgykorúak (75 pont)cpp17Wrong answer 35/759ms544 KiB
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int eg = 0;
	vector<int> P(3);
	int R[n][3];
	int H[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
	for(int i = 0;i<3;i++) cin>>P[i];
	for(int i = 0;i<n;i++){
		int peter = 0;
		if(P[0]%4 == 0 && P[1] > 2){
			for(int j = 0;j<P[1]-2;j++){
				peter += H[j];
			}
			peter++;
			peter+= P[2];
		}
		else{
			for(int j = 0;j<P[1]-2;j++) peter += H[j];
			peter += P[2]; 
		}
		for(int j = 0;j<3;j++){
			cin>>R[i][j];
		}
		
		int random = 0;
		
		if(R[i][0]%4 == 0 && R[i][1] > 2){
			for(int j = 0;j<R[i][1]-2;j++){
				random += H[j];
			}
			random ++;
			random += R[i][2];
		}
		else{
			for(int j = 0;j<R[i][1]-2;j++) random += H[j];
			random += R[i][2]; 
		}
		if(P[0] == R[i][0]) eg++;
		else if(abs(P[0]-R[i][0]) == 1){
			if(P[0] > R[i][0]) peter+= 365;
			else random += 365;
			if(max(peter,random) - min(peter,random) <= 365) eg++;
		}
	}
	cout<<eg<<endl;
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base35/75
1Accepted0/03ms448 KiB
2Accepted0/09ms544 KiB
3Accepted5/53ms356 KiB
4Accepted5/53ms420 KiB
5Accepted5/52ms356 KiB
6Wrong answer0/53ms420 KiB
7Accepted5/52ms384 KiB
8Accepted5/53ms504 KiB
9Accepted5/53ms384 KiB
10Wrong answer0/54ms352 KiB
11Accepted5/54ms376 KiB
12Wrong answer0/54ms492 KiB
13Wrong answer0/56ms400 KiB
14Wrong answer0/57ms400 KiB
15Wrong answer0/57ms484 KiB
16Wrong answer0/58ms484 KiB
17Wrong answer0/58ms484 KiB