39682023-03-07 07:41:23CWMAranycipők (45)cpp17Wrong answer 0/453ms3720 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
SubtaskSumTestVerdictTimeMemory
base0/45
1Wrong answer0/03ms1700 KiB
2Wrong answer0/03ms2200 KiB
3Wrong answer0/32ms2096 KiB
4Wrong answer0/33ms2296 KiB
5Wrong answer0/33ms2512 KiB
6Wrong answer0/32ms2700 KiB
7Wrong answer0/32ms2708 KiB
8Wrong answer0/32ms2940 KiB
9Wrong answer0/32ms2924 KiB
10Wrong answer0/32ms3052 KiB
11Wrong answer0/32ms3140 KiB
12Wrong answer0/32ms3144 KiB
13Wrong answer0/32ms3204 KiB
14Wrong answer0/32ms3440 KiB
15Wrong answer0/32ms3416 KiB
16Wrong answer0/33ms3636 KiB
17Wrong answer0/32ms3720 KiB