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

 Formula None Racer (Posted on 2003-10-03)
A car is travelling at a uniform speed.
The driver sees a milestone showing a 2-digit number. After travelling for an hour the driver sees another milestone with the same digits in reverse order. After another hour the driver sees another milestone containing the same two digits as in the first one but the two digits separated by a zero(0).

What is the speed of the car?

 See The Solution Submitted by Ravi Raja Rating: 2.6000 (10 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Well, since fwaff was expecting one. | Comment 7 of 35 |

There being an analytic solution already, I wasn't going to post the brute force program, but it looks like fwaff expects one so I shan't disappoint:
FOR a = 12 TO 89
a\$ = LTRIM\$(STR\$(a))
b\$ = RIGHT\$(a\$, 1) + LEFT\$(a\$, 1)
b = VAL(b\$)
c = 2 * b - a
c\$ = LTRIM\$(STR\$(c))
IF LEFT\$(c\$, 1) = LEFT\$(a\$, 1) AND RIGHT\$(c\$, 1) = RIGHT\$(a\$, 1) AND MID\$(c\$, 2, 1) = "0" THEN
PRINT a, b, c
END IF
NEXT

The only pre-analysis that went in is that the three-digit milestone came after the two-digit ones, so the miles were going up rather than down, giving the limits for the first milestone as 12 to 89.
 Posted by Charlie on 2003-10-03 11:21:10

 Search: Search body:
Forums (0)