Devil's Annual Leave Calculator
InterviewTime limit1sMemory limit512 MB
Given a joining date and a later date on a 30-day month, 12-month year calendar, compute total monthly and annual leave earned plus days of service.
- Level
Medium4 of 10
- Topics
- Implementation, Math, Simulation, Brute force
- Solved
- No attempts yet
Problem
Note: This problem assumes a fictional calendar where a month has 30 days and a year has 12 months, instead of the usual calendar.
Anyone who works a full year (360 days) deserves vacation. So our company wants to give annual leave and monthly leave. Using annual leave or monthly leave lets you rest for a day. But because we are so short-staffed, the annual leave and monthly leave we can hand out have shrunk to almost nothing. The employees, unaware of this internal situation, are happy to receive their leave. When employees work a lot, the boss is happy. Anyway, to further improve the employees' convenience, we want to show each person the calculated result of their annual and monthly leave, raising job satisfaction.
So let us look at how each is calculated. First, the day of joining counts as month 0, and the -th year means the state months after the day of joining.
- Monthly leave and annual leave are granted on the same day of each month and each year as the joining day.
- Monthly leave is granted one at a time for every 1 month (30 days) that passes, up to the 3rd year (month 36). That is, at most 36 can be granted.
- Annual leave is granted at per year.
- However, on the day of joining, no annual or monthly leave is granted.
The value of starts at 0 when you join and increases by 1 every years (). For example, in years 1 and 2, . After that, in years 3 and 4, , and in years 5 and 6, .
Employees enter two dates and into the system. is the joining date, and is some future date relative to . Our job is to build a system that reports the total number of annual and monthly leave obtainable and the length of service when someone joins on date and works until date . The length of service means how many days have passed since the user joined.
Please~ make it~
Input
and are given over two lines in the format Year Month Day. Each number is separated by a space.
-
Year -
Month -
Day
The second date given is a future date relative to the first date. That is, .
Output
On the first line, print the total number of annual and monthly leave, separated by a space. On the second line, print the total length of service followed by days. Even if the length of service is 1 day, you must print days, not day.