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?
(In reply to re: please ignore
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
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