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

 Compare two problems (Posted on 2013-05-20)
Solve:
ROBOT=40*ONLY

Compare the number of its possible solutions with that of the following problem:
ROBOT:IT=ONLY

 See The Solution Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solutions | Comment 1 of 3
`Part 1: 92720         2318Part 2: 43032  12     3586 61215  35     1749 82620  30     2754 82920  30     2764 92720  40     2318`

from

DEFDBL A-Z
PRINT "Part 1:"
FOR r = 1 TO 9
used(r) = 1
FOR o = 1 TO 9
IF used(o) = 0 THEN
used(o) = 1
FOR b = 0 TO 9
IF used(b) = 0 THEN
used(b) = 1
FOR t = 0 TO 9
IF used(t) = 0 THEN
used(t) = 1
FOR n = 0 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR l = 0 TO 9
IF used(l) = 0 THEN
used(l) = 1
FOR y = 0 TO 9
IF used(y) = 0 THEN
used(y) = 1

robot = 10000 * r + 1010 * o + 100 * b + t
only = 1000 * o + 100 * n + 10 * l + y
IF only * 40 = robot THEN PRINT robot, only

used(y) = 0
END IF
NEXT
used(l) = 0
END IF
NEXT
used(n) = 0
END IF
NEXT
used(t) = 0
END IF
NEXT
used(b) = 0
END IF
NEXT
used(o) = 0
END IF
NEXT
used(r) = 0
NEXT

PRINT "Part 2:"

FOR r = 1 TO 9
used(r) = 1
FOR i = 1 TO 9
IF used(i) = 0 THEN
used(i) = 1
FOR o = 1 TO 9
IF used(o) = 0 THEN
used(o) = 1
FOR b = 0 TO 9
IF used(b) = 0 THEN
used(b) = 1
FOR t = 0 TO 9
IF used(t) = 0 THEN
used(t) = 1
FOR n = 0 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR l = 0 TO 9
IF used(l) = 0 THEN
used(l) = 1
FOR y = 0 TO 9
IF used(y) = 0 THEN
used(y) = 1

robot = 10000 * r + 1010 * o + 100 * b + t
it = 10 * i + t
only = 1000 * o + 100 * n + 10 * l + y
IF only * it = robot THEN PRINT robot; it, only

used(y) = 0
END IF
NEXT
used(l) = 0
END IF
NEXT
used(n) = 0
END IF
NEXT
used(t) = 0
END IF
NEXT
used(b) = 0
END IF
NEXT
used(o) = 0
END IF
NEXT
used(i) = 0
END IF
NEXT
used(r) = 0
NEXT

 Posted by Charlie on 2013-05-20 17:42:12

 Search: Search body:
Forums (0)