Problem F
It's About Time
Greg Orian works for the Temporal Innovations for Multiple
Earths (TIME) program. One of his main jobs is determining
yearly calendars for the numerous human colonies on various
planets (did we mention this problem takes place in
-
Any year divisible by
is a leap year, unless -
the year is divisible by
in which case the year is not a leap year, unless -
the year is divisible by
in which case the year is a leap year.
Leap days are needed since the
While this works fine for GoE, it obviously won’t work for
planets with different tropical years. The colonists have
enough to adjust to already (lower oxygen levels, colonial
in-fighting, people-eating plants, etc.) so Greg wants to come
up with rules that are similar to the ones for GoE. He’s hit on
the following scheme for finding three values
-
The number of days
in a non-leap year is the number of days in a tropical year, rounded to the nearest integer. If the fractional number of days is exactly , round the number of days up. -
If you rounded the tropical year down then
-
every year divisible by
is a leap year (i.e., you add day that year), unless -
the year is divisible by
(where and is a multiple of ) in which case the year is not a leap year, unless -
the year is divisible by
(where and is a multiple of ) in which case the year is a leap year.
-
-
If you rounded the tropical year up then the same rules apply except that you subtract
day from leap years instead of adding (would these be leak years?).
For GoE these numbers would be
Input
Input contains a single line with three positive integers
Output
Output the values
Sample Input 1 | Sample Output 1 |
---|---|
92998938 66660 24 |
4 100 400 |
Sample Input 2 | Sample Output 2 |
---|---|
92998938 66660 25 |
2 6 30 |