#CCBCMCHIN0000058. Cộng một ngày trong tháng (Advance Date by One Day)
Cộng một ngày trong tháng (Advance Date by One Day)
Advance Date by One Day
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a valid Gregorian date , compute the following calendar date. Advance the day normally, roll over the month at its last day, and roll over the year after December 31.
Input
One line contains three integers d,m,y in that order.
Output
Print the resulting day, month and year separated by spaces.
Subtasks
-
Subtask 1 (20 points): A valid date not at the end of its month, year between 1 and 9998.
-
Subtask 2 (30 points): Valid date with month in {1,3,4,5,6,7,8,9,10,11}; year between 1 and 9998.
-
Subtask 3 (50 points): Any valid date, year between 1 and 9998.
Examples
Example 1
Input
28 2 2024
Output
29 2 2024
Explanation
For this input, the case-specific computation and the required exact output are shown above. 2024 is a leap year. February has 29 days, so the date advances to February 29.
Example 2
Input
31 12 2023
Output
1 1 2024
Explanation
For this input, the case-specific computation and the required exact output are shown above. After December 31, the day and month both reset to 1 while the year increases to 2024.