39782023-03-07 12:32:58bzsofiaVilágnaptár (45 pont)cpp11Hibás válasz 42/453ms3624 KiB
// naptar.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>

using namespace std;

long long ho, nap, ev, i;

int main()
{
	cin >> ev>>ho>>nap;
	vector <int> vilag(13);

	for (i = 1; i <= 12; ++i)
	{
		vilag[i] = 30;
		vilag[i] += vilag[i - 1];
		if (i == 1 || i == 4 || i == 7 || i == 10) ++vilag[i];
	}

	nap += (ho-1) * 31;
	if (ho >= 3)
	{
		if (ev % 4 == 0) nap -= 2;
		else nap -= 3;
	}
	if (ho >= 5) --nap;
	if (ho >= 7) --nap;
	if (ho >= 10) --nap;
	if (ho >= 12) --nap;

	if (nap == 365)
	{
		cout << ev << " 12 VN";
		return 0;
	}

	i = 1;
	while (i <= 12 && vilag[i] < nap)
	{
		++i;
	}

	cout << ev << " ";
	if (i == 7 && nap - vilag[i - 1] == 1) cout << "6 SZN";
	else cout << i << " " << nap - vilag[i - 1];
	return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
RészfeladatÖsszpontTesztVerdiktIdőMemória
base42/45
1Elfogadva0/03ms1956 KiB
2Elfogadva0/03ms2012 KiB
3Elfogadva0/03ms2228 KiB
4Elfogadva2/23ms2588 KiB
5Elfogadva2/23ms2716 KiB
6Elfogadva3/33ms2720 KiB
7Elfogadva3/32ms2656 KiB
8Elfogadva3/33ms2908 KiB
9Elfogadva3/32ms2868 KiB
10Hibás válasz0/33ms3000 KiB
11Elfogadva3/32ms3088 KiB
12Elfogadva3/33ms3320 KiB
13Elfogadva3/32ms3296 KiB
14Elfogadva3/33ms3536 KiB
15Elfogadva3/32ms3624 KiB
16Elfogadva3/32ms3508 KiB
17Elfogadva3/32ms3504 KiB
18Elfogadva2/22ms3512 KiB
19Elfogadva3/32ms3504 KiB