ECOO 2002 Boardwide Programming Contest

Problem 3: Serial Number Dates

Every spreadsheet uses a special number to record dates and time. For example, the number 35835.69412 represents 10 Feb 2002, 4:39 pm. The integer part of the serial number, 35835, stands for the number of days since 1 Jan 1904, and the fractional part, stands for the fraction of the current day that has passed: .69412 = 999/1440. In other words, 35835 days and 999 minutes have passed since midnight, 1 Jan 1904.

Note that 12 Nov 2002 24:00:00 o'clock is an invalid result, and must be rewritten as: 13 Nov 2002, 0:00:00 o'clock.

Write a program that reads 5 serial numbers from input and prints out the exact date and time that is represented. As in the example below, you must include seconds.

Dates will vary between 1 Jan 1904 and 31 Dec 2099.

Note that the leap years are every year that is divisible by 4, including the year 2000:
The serial number for 29 Feb 2000 is 35123.

Sample Input:

35835.69412
71582.86421
1.2345
4444.4444
1234.5678

Sample Output:

year = 2002 month = 2 day = 10
time is: 16:39:32

year = 2099 month = 12 day = 25
time is: 20:44:28

year = 1904 month = 1 day = 2
time is:  5:37:41

year = 1916 month = 3 day = 2
time is: 10:39:57

year = 1907 month = 5 day = 19
time is: 13:37:38

All Submissions
Best Solutions


Point Value: 10
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 04, 2009

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

It's quiet in here...