Problem 110: Chicken Time
(U.M. ACM Runoffs 2002, problem 3)
Description
Chickens don't live very long,
and that used to have some unfortunate consequences.
Their grave-stones can
be less than informative:
Which led statisticians
to reason that many chickens were probably born after they had died.
An intolerable situation.
So the chicken parliament
decided some years ago to adjust their timekeeping. Chicken clocks
now run exactly 75 times faster than human clocks. A chicken minute
is only 0.8 human seconds; a chicken hour is 48 human seconds; a
chicken day is 19 minutes and 12 seconds by human reckoning, and so on.
Interestingly, chickens use the
Julian calendar in which every fourth year is a leap year, instead of
the human standard Gregorian calendar which is the same except that
century years (1900, 2000, 2100, etc) are only leap years if they
are divisible by 400. So in the chicken calendar, 1900, 2000, and
2100 were all leap years, but for humans only 2000 was.
Apart from that, the chicken
and human calendars are exactly the same. Months have the same numbers
of days and everything. By an amazing coincidence, the human and chicken
time systems exactly coincided at the midnight between 31st December 1999
and 1st January 2000. Thus the chicken date 2nd January 2000 started at
the human time 12 seconds past 19 minutes past midnight on 1st January 2000.
Your task is to write a program that
converts chicken dates to human dates and times. You will read chicken
dates in numeric format (year then month then day, "0 0 0" marks the end)
and print out the human time (in 24-hour format) and date on which that
chicken day started. The human dates should be printed in 24-hour format,
with leading zeros to make all components up to two digits, exact to the
second. Dates should be printed in numeric form, with a four digit year
and two digit month and day, with leading zeros if necessary. Your output
should be formatted exactly as in the samples below.
All input dates will be valid
(e.g. no 73rd March, no 29th February except in a leap year), and the
chicken year will be between 2000 and 2999 inclusive. "AP" stands for
Anno Pulli, "in the year of the chicken", and is used to distinguish
chicken dates.
Sample Input
2000 1 1
2000 1 2
2000 1 31
2000 2 1
2001 1 1
0 0 0
Sample Output
AP 2000-01-01 -> AD 2000-01-01 00:00:00
AP 2000-01-02 -> AD 2000-01-01 00:19:12
AP 2000-01-31 -> AD 2000-01-01 09:36:00
AP 2000-02-01 -> AD 2000-01-01 09:55:12
AP 2001-01-01 -> AD 2000-01-05 21:07:12
End of Problem