81382024-01-12 14:21:36DominikVilágnaptár (45 pont)csharpWrong answer 33/4528ms24112 KiB
using System;

namespace vilagnaptar2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            int ev = int.Parse(line[0]);
            int honap = int.Parse(line[1]);
            int nap = int.Parse(line[2]);
            int[] napok = new int[12] { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
            int[] napok1 = new int[13] { 0, 31, 61, 91, 122, 152, 182, 213, 243, 273, 304, 334, 365 };
            int[] napok2 = new int[13] { 0, 31, 61, 91, 122, 152, 183, 214, 244, 274, 305, 335, 366 };
            int newnap = -1, newhonap = -1;
            if (ev % 4 == 0)
            {
                if (honap==7&&nap==1)
                {
                    Console.WriteLine(ev + " " + 6 + " SZN");
                }
                else if (honap==12&&nap==31)
                {
                    Console.WriteLine(ev + " " + honap + " VN");
                }
                else
                {
                    int elteltnap = napok[honap - 1] + nap;
                    for (int i = 0; i < napok2.Length; i++)
                    {
                        if (napok2[i] >= elteltnap)
                        {
                            newhonap = i;
                            newnap = elteltnap - napok2[i-1];
                            i = napok2.Length;
                        }
                    }
                    Console.WriteLine(ev + " " + newhonap + " " + newnap);
                }
            }
            else
            {
                if (honap == 12 && nap == 31)
                {
                    Console.WriteLine(ev + " " + honap + " VN");
                }
                else
                {
                    int elteltnap = napok[honap - 1] + nap;
                    //int iciklus = 0;
                    for (int i = 0; i < napok1.Length; i++)
                    {
                        if (napok1[i] >= elteltnap)
                        {
                            newhonap = i;
                            newnap = elteltnap - napok1[i - 1];
                            i = napok1.Length;
                        }
                    }
                    Console.WriteLine(ev + " " + newhonap + " " + newnap);
                }
            }
            
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base33/45
1Accepted0/028ms20384 KiB
2Accepted0/028ms20652 KiB
3Accepted0/028ms21252 KiB
4Accepted2/228ms21688 KiB
5Accepted2/228ms22384 KiB
6Accepted3/327ms22704 KiB
7Wrong answer0/328ms22444 KiB
8Accepted3/328ms22936 KiB
9Accepted3/328ms23192 KiB
10Wrong answer0/328ms23368 KiB
11Wrong answer0/328ms23552 KiB
12Accepted3/328ms23388 KiB
13Accepted3/328ms23652 KiB
14Accepted3/328ms23616 KiB
15Accepted3/328ms24076 KiB
16Accepted3/328ms23980 KiB
17Accepted3/328ms23832 KiB
18Accepted2/228ms24112 KiB
19Wrong answer0/328ms24092 KiB