49322023-04-07 13:57:23zolmikiVilágnaptár (45 pont)javaAccepted 45/4590ms50164 KiB
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class main {


    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] readed = br.readLine().split(" ");
        int year = Integer.parseInt(readed[0]);
        int month = Integer.parseInt(readed[1]);
        int day = Integer.parseInt(readed[2]);

        if (month == 12 && day == 31) {
            System.out.println(year + " 12 VN");
        } else if (year % 4 == 0 && month == 7 && day == 1) {
            System.out.println(year + " 6 SZN");
        } else {
            int [] normalMonthLengths = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
            int [] worldMonthLenghts = new int[]{31, 30, 30, 31, 30, 30, 31, 30, 30, 31, 30, 30};

            if(year % 4 == 0){
                normalMonthLengths[1] += 1;
                worldMonthLenghts[5] += 1;
            }

            int passedDays = 0;
            for (int i = 0; i < month - 1; i++) {
                passedDays += normalMonthLengths[i];
            }
            passedDays += day;


            for (int i = 0; i < 12; i++) {
                if (passedDays - worldMonthLenghts[i] <= 0) {
                    month = i + 1;
                    break;
                } else {
                    passedDays -= worldMonthLenghts[i];
                }
            }

            System.out.println(year + " " + month + " " + passedDays);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/083ms46316 KiB
2Accepted0/082ms47000 KiB
3Accepted0/082ms47256 KiB
4Accepted2/282ms47708 KiB
5Accepted2/282ms47136 KiB
6Accepted3/383ms47812 KiB
7Accepted3/383ms48020 KiB
8Accepted3/383ms47780 KiB
9Accepted3/382ms48044 KiB
10Accepted3/382ms47864 KiB
11Accepted3/390ms48920 KiB
12Accepted3/385ms49196 KiB
13Accepted3/383ms49636 KiB
14Accepted3/382ms50124 KiB
15Accepted3/382ms49632 KiB
16Accepted3/382ms49472 KiB
17Accepted3/382ms49624 KiB
18Accepted2/282ms50164 KiB
19Accepted3/385ms49556 KiB