120582024-11-27 08:10:58RRoliVilágnaptár (45 pont)cpp17Accepted 45/451ms512 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int ev, ho, nap;
	cin >> ev >> ho >> nap;
	for(int i = ho-1; i >= 1; i--) {
		if(i == 2) {
			if(ev%4==0) nap += 29;
			else nap += 28;
		}
		else if(i == 4 || i == 6 || i == 9 || i == 11) nap += 30;
		else nap += 31;
	}
	int sz = 1;
	while(sz <= 12) {
		int napsz;
		if(sz == 1 || sz == 4 || sz == 7 || sz == 10 || sz == 12 || (ev%4 == 0 && sz == 6)) napsz = 31;
		else napsz = 30;
		if(napsz == nap) {
			if(ev%4 == 0 && sz == 6) cout << ev << ' ' << sz << " SZN";
			else if(sz == 12) cout << ev << ' ' << sz << " VN";
			else cout << ev << ' ' << sz << ' ' << nap;
			break;
		} else if(nap < napsz) {
			cout << ev << ' ' << sz << ' ' << nap;
			break;
		}
		nap -= napsz;
		sz++;
	}

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/01ms508 KiB
2Accepted0/01ms320 KiB
3Accepted0/01ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted3/31ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms320 KiB
9Accepted3/31ms320 KiB
10Accepted3/31ms320 KiB
11Accepted3/31ms512 KiB
12Accepted3/31ms320 KiB
13Accepted3/31ms320 KiB
14Accepted3/31ms320 KiB
15Accepted3/31ms320 KiB
16Accepted3/31ms320 KiB
17Accepted3/31ms320 KiB
18Accepted2/21ms320 KiB
19Accepted3/31ms500 KiB