A slug and a snail decided to settle a longstanding argument as to who was the best sprinter. So they planned a race between two stones set a distance D cm apart. Said the slug to the snail:
 "Since I'm slimier than you, I intend to start T seconds before you".
 "In that case," said the snail, who was rather slow, "I'm going to give you X cm start" (the snail stays at the stone, and the slug starts from X cm ahead.)
It didn't matter. The slug, who could move at speed V cm/sec, was only half as fast as the snail. The result was a dead heat, t seconds after the slug set off.
Now, D, t, T, V and X were all whole numbers from 1 to 10 inclusive, no two numbers being the same.
How long did it take the snail to reach the finish?
(In reply to
a solution by Dej Mar)
There are two sets of values for the five variables, that both lead to the same travel time (t  T) = 7  2 = 8  3 = 5 seconds for the snail:
D t T V X
10 7 2 1 3
10 8 3 1 2
The program would find any solution, so the above two sets exhaust the possibilities.
FOR d = 1 TO 10
taken(d) = 1
FOR smt = 1 TO 10
IF taken(smt) = 0 THEN
taken(smt) = 1
FOR t = 1 TO 10
IF taken(t) = 0 THEN
taken(t) = 1
FOR v = 1 TO 10
IF taken(v) = 0 THEN
taken(v) = 1
FOR x = 1 TO 10
IF taken(x) = 0 THEN
taken(x) = 1
IF smt = (d  x) / v THEN
IF (smt  t) = d / (2 * v) THEN
PRINT d; smt; t; v; x
END IF
END IF
taken(x) = 0
END IF
NEXT x
taken(v) = 0
END IF
NEXT v
taken(t) = 0
END IF
NEXT t
taken(smt) = 0
END IF
NEXT smt
taken(d) = 0
NEXT d
Edited on October 27, 2008, 11:08 pm
Edited on October 28, 2008, 9:58 am

Posted by Charlie
on 20081027 23:06:37 