39692023-03-07 07:41:38CWMVilágnaptár (45 pont)cpp17Elfogadva 45/453ms4132 KiB
// Nemes2.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <unordered_set>

using namespace std;

vector<int> solution;
void DFS(int a, vector<vector<int>>& graph, int cameFrom) {
	if (graph[a].size() > 2) return;
	for (size_t i = 0; i < graph[a].size(); i++)
	{
		if (graph[a][i] != cameFrom) {
			solution.push_back(graph[a][i]);
			DFS(graph[a][i], graph, a);
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	//norm (31, 28/29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
	//neww (31, 30, 30, 31, 30, 30/31, 31, 30, 30, 31, 30, 31)
	vector<int> norm{ 31,28,31,30,31,30,31,31,30,31,30,31 };
	vector<int> neww{ 31,30,30,31,30,30,31,30,30,31,30,31 };
	int y, m, d;
	cin >> y >> m >> d;
	if (y % 4 == 0) {
		norm[1]++;
		neww[5]++;
	}
	int day = d;
	int dayw = 0;
	int mw = 0;
	int dw = 0;
	for (size_t i = 0; i < m-1; i++)
	{
		day += norm[i];
	}
	for (size_t i = 0; i < 12; i++)
	{
		if (day <= dayw + neww[i]) {
			dw = day - dayw;
			mw = i + 1;
			break;
		}
		else dayw += neww[i];
	}
	if (y % 4 == 0 && mw == 6 && dw == 31) {
		cout << y << " " << mw << " " << "SZN";
	}
	else if (mw == 12 && dw == 31) {
		cout << y << " " << mw << " " << "VN";
	}
	else cout << y << " " << mw << " " << dw;
}

// 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
base45/45
1Elfogadva0/03ms1828 KiB
2Elfogadva0/02ms2056 KiB
3Elfogadva0/02ms2264 KiB
4Elfogadva2/22ms2468 KiB
5Elfogadva2/23ms2564 KiB
6Elfogadva3/33ms2776 KiB
7Elfogadva3/32ms2968 KiB
8Elfogadva3/32ms3048 KiB
9Elfogadva3/33ms3312 KiB
10Elfogadva3/33ms3396 KiB
11Elfogadva3/32ms3484 KiB
12Elfogadva3/32ms3480 KiB
13Elfogadva3/33ms3848 KiB
14Elfogadva3/32ms3956 KiB
15Elfogadva3/32ms4036 KiB
16Elfogadva3/33ms4132 KiB
17Elfogadva3/32ms4016 KiB
18Elfogadva2/22ms4012 KiB
19Elfogadva3/32ms4116 KiB