3969 2023. 03. 07 07:41:38 CWM Világnaptár (45 pont) cpp17 Elfogadva 45/45 3ms 4132 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 Összpont Teszt Verdikt Idő Memória
base 45/45
1 Elfogadva 0/0 3ms 1828 KiB
2 Elfogadva 0/0 2ms 2056 KiB
3 Elfogadva 0/0 2ms 2264 KiB
4 Elfogadva 2/2 2ms 2468 KiB
5 Elfogadva 2/2 3ms 2564 KiB
6 Elfogadva 3/3 3ms 2776 KiB
7 Elfogadva 3/3 2ms 2968 KiB
8 Elfogadva 3/3 2ms 3048 KiB
9 Elfogadva 3/3 3ms 3312 KiB
10 Elfogadva 3/3 3ms 3396 KiB
11 Elfogadva 3/3 2ms 3484 KiB
12 Elfogadva 3/3 2ms 3480 KiB
13 Elfogadva 3/3 3ms 3848 KiB
14 Elfogadva 3/3 2ms 3956 KiB
15 Elfogadva 3/3 2ms 4036 KiB
16 Elfogadva 3/3 3ms 4132 KiB
17 Elfogadva 3/3 2ms 4016 KiB
18 Elfogadva 2/2 2ms 4012 KiB
19 Elfogadva 3/3 2ms 4116 KiB