All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 A Clockwork O'Range (Posted on 2007-11-16)

Sometime last year, while sitting at my desk, my spouse took a photograph of me. You could figure the date and time the photo was taken because sitting beside me was my digital clock displaying the current time and date (at the time) in the format [hh:mm:ss | MM/DD].
I noticed later that the time and date displayed was the mid-point between the earliest date-time that could be displayed on my clock using only the digits 0-9 once each and the latest date-time with the same constraint.

In the photograph, what time did my clock display?

(Assume, for the problem, that the year in question is neither a leap year nor does the region observe Daylight Savings.)

 See The Solution Submitted by Dej Mar Rating: 2.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Is there more than one possibility? (spoiler) | Comment 1 of 3

OPEN "clockorg.txt" FOR OUTPUT AS #2
DATA 31,28,31,30,31,30,31,31,30,31,30,31
DIM monLen(12)
FOR i = 1 TO 12: READ monLen(i): NEXT
FOR m = 1 TO 12
mm\$ = RIGHT\$("0" + LTRIM\$(STR\$(m)), 2)
FOR d = 1 TO monLen(m)
dd\$ = RIGHT\$("0" + LTRIM\$(STR\$(d)), 2)
FOR h = 0 TO 23
hh\$ = RIGHT\$("0" + LTRIM\$(STR\$(h)), 2)
FOR min = 0 TO 59
mim\$ = RIGHT\$("0" + LTRIM\$(STR\$(min)), 2)
FOR s = 0 TO 59
ss\$ = RIGHT\$("0" + LTRIM\$(STR\$(s)), 2)

tst\$ = mm\$ + dd\$ + hh\$ + mim\$ + ss\$
good = 1
FOR i = 1 TO LEN(tst\$) - 1
IF INSTR(MID\$(tst\$, i + 1), MID\$(tst\$, i, 1)) THEN good = 0: EXIT FOR
NEXT
IF good THEN PRINT hh\$; ":"; mim\$; ":"; ss\$; "|"; mm\$; "/"; dd\$
IF good THEN PRINT #2, hh\$; ":"; mim\$; ":"; ss\$; "|"; mm\$; "/"; dd\$
NEXT
NEXT
NEXT
NEXT
NEXT
CLOSE

The program tests each second of the year. If there are no repeat digits, the time and date are written to the file.  There are 768 seconds (out of the 31,536,000) in the year that meet this criterion, of which the first is 17:48:59|03/26 and the last is 17:56:43|09/28.

3/26 is the 85th day of a non-leap year and 9/28 is the 271st. Midway between is the 178th day, or 6/27.  Midway between 17:48:59 and 17:56:43 is 17:52:51.

So midway between the first instance and the last instance is 17:52:51 on 6/27. This is presumably later in the same day that the picture was taken. The prior times on that day that the all-digit criterion was met were:

`13:48:59|06/2713:49:58|06/2713:58:49|06/2713:59:48|06/2714:38:59|06/2714:39:58|06/2714:58:39|06/2714:59:38|06/2715:38:49|06/2715:39:48|06/2715:48:39|06/2715:49:38|06/27`

I'm not really sure how we can distinguish which of these is the time the photo was taken.  Each one allows for 17:52:51|6/27 to be later in the day.

Leap year doesn't affect it as all the dates are after February (and February 29 wouldn't have any times that satisfy the criterion) so that the day numbers are all increased by one, and the average still translates to 6/27.

 Posted by Charlie on 2007-11-16 10:41:44

 Search: Search body:
Forums (0)
Random Problem
Site Statistics
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox: