212432026-01-12 17:25:34PappMatyasVilágnaptár (45 pont)cpp17Elfogadva 45/452ms560 KiB
#include <iostream>

using namespace std;

int main()
{
	int nday[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int wday[12] = { 31, 30, 30, 31, 30, 30, 31, 30, 30, 31, 30, 30 };
	int y, m, d;
	cin >> y >> m >> d;

	cout << y << " ";
	if (m == 12 && d == 31)
	{
		cout << "12 VN";
		return 0;
	}
	if (y % 4 == 0 && m == 7 && d == 1)
	{
		cout << "6 SZN";
		return 0;
	}
 
	if (y % 4 == 0)
	{
		nday[1]++;
		wday[5]++;
	}

	for (int i = 1; i < 12; i++)
	{
		nday[i] = nday[i - 1] + nday[i];
		wday[i] = wday[i - 1] + wday[i];
	}
	int total;
	if (m != 1)
	{
		total = nday[m - 2] + d;
	}
	else
	{
		total = d;
	}

	int newMonth = 1;
	while (total > wday[newMonth - 1])
	{
		newMonth++;
	}

	if (newMonth != 1)
	{
		cout << newMonth << " " << total - wday[newMonth - 2];
	}
	else
	{
		cout << newMonth << " " << total;
	}

	return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base45/45
1Elfogadva0/02ms316 KiB
2Elfogadva0/01ms316 KiB
3Elfogadva0/01ms316 KiB
4Elfogadva2/22ms316 KiB
5Elfogadva2/21ms560 KiB
6Elfogadva3/31ms316 KiB
7Elfogadva3/31ms316 KiB
8Elfogadva3/31ms508 KiB
9Elfogadva3/32ms316 KiB
10Elfogadva3/32ms316 KiB
11Elfogadva3/31ms332 KiB
12Elfogadva3/31ms508 KiB
13Elfogadva3/31ms316 KiB
14Elfogadva3/31ms316 KiB
15Elfogadva3/31ms316 KiB
16Elfogadva3/31ms316 KiB
17Elfogadva3/31ms316 KiB
18Elfogadva2/21ms508 KiB
19Elfogadva3/31ms316 KiB