135062025-01-08 08:57:23Leventusz09Világnaptár (45 pont)cpp17Wrong answer 42/452ms500 KiB
#include <iostream>

using namespace std;

int main() {
	int Év, Hó, Nap;
	cin >> Év >> Hó >> Nap;
	bool Sz = (Év % 4 == 0);
	//           Jan. Feb. Márc. Ápr. Máj. Jún. Júl. Aug. Szept. Okt. Nov. Dec.
	int hs[12] = {31,  28,   31,  30,  31,  30,  31,  31,    30,  31,  30, 31};
	int  h[12] = {31,  30,   30,  31,  30,  30,  31,  30,    30,  31,  30, 30};

	if (Hó == 12 && Nap == 31) {
		cout << Év << " 12 VN\n";
		return 0;
	}
	int n = Nap;
	for (int i = 1; i < Hó; i++) n += hs[i - 1];
	if(Hó>=3) n += Sz;

	int oh = 1;
	while(n > 31){
		n -= h[oh - 1];
		oh++;
	}
	if (oh == 6 && n == 31) {
		cout << Év << " 6 SZN\n";
		return 0;
	}
	if (h[oh - 1] < n) {
		oh++;
		n = 1;
	}
	if (n == 0) {
		oh--;
		n = h[oh - 1];
	}
	cout << Év << " " << oh << " " << n << endl;
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/45
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted0/01ms500 KiB
4Accepted2/21ms500 KiB
5Accepted2/21ms316 KiB
6Accepted3/31ms376 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms320 KiB
10Wrong answer0/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted3/31ms316 KiB
14Accepted3/31ms316 KiB
15Accepted3/31ms316 KiB
16Accepted3/31ms316 KiB
17Accepted3/32ms316 KiB
18Accepted2/22ms316 KiB
19Accepted3/32ms316 KiB