Problem Statement | |||||||||||||
You are a big fan of New Year's Eve parties. The next one is not too far away, and you are already looking forward to it. Then, one day, you wake up with a question: "Wait a moment, exactly how far away is it?" To answer this question, you decided to implement a simple application: a year progress bar that will always show how much of the current year has already passed. In this problem, your goal is to implement the most important part of this application: a function that gets a String currentDate, and returns the elapsed part of the year, as a percentage. The variable currentDate will be of the form "Month DD, YYYY HH:MM" (quotes for clarity). Here, "Month" is the name of the current month, "YYYY" is a four-digit number representing the current year, and "DD", "HH", and "MM" are two-digit numbers (possibly with a leading zero) that represent the current day, hour and minute. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | The months of a normal year have 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, and 31 days. | ||||||||||||
- | In leap years, the second month (February) has 29 days. | ||||||||||||
- | A year is a leap year if (it is divisible by 400) or (it is divisible by 4, but not by 100). | ||||||||||||
- | Ignore location-dependent changes to time flow such as daylight saving time. | ||||||||||||
- | Your return value must have a relative or absolute error less than 1e-9. | ||||||||||||
Constraints | |||||||||||||
- | currentDate will be of the form given in the problem statement. | ||||||||||||
- | Month will be one of January, February, March, April, May, June, July, August, September, October, November, and December. | ||||||||||||
- | YYYY will be between 1800 and 2600, inclusive. | ||||||||||||
- | DD will be between 01 and the number of days in the given month (in the given year), inclusive. | ||||||||||||
- | HH will be between 00 and 23, inclusive. | ||||||||||||
- | MM will be between 00 and 59, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
|