Each letter of the alphabet has been assigned a different value from 1 to 26. The total values of the letters contained in a given word are as
given below. Determine the value assigned to each letter of the alphabet.
BEG = 59 CALL = 48 CHIEF = 36 CRAZY = 60
DEN = 53 GAME = 47 GUN = 51 HAM = 16
HAVE = 40 IF = 11 JACK = 24 KEY = 43
LAZE = 57 MAP = 28 MOVE = 58 NEON = 86
OXEN = 82 PALM = 47 QUIT = 40 QUITE = 60
STALL = 80 TALK = 39 TORE = 73 VAST = 51
WALK = 54
*** Pen and Paper solution only.
From QUIT and QUITE, E=20.
From MAP and PALM, L=19.
Then from LAZE, AZ=18.
From CALL, AC=10.
With a few other observations, the program became reasonable in run time, as only n, a, k, m, g and f then needed to be run through all possibilities remaining after the used numbers were left, with the other letters being derived from these:
DIM used(26)
CLS
e = 20: l = 19
used(e) = 1: used(l) = 1
FOR n = 1 TO 26
o = 86 - 2 * n - e
x = 82 - n - e - o
d = 53 - n - e
IF o > 0 AND o < 27 AND x > 0 AND x < 27 AND d > 0 AND d < 27 THEN
IF used(n) = 0 AND used(x) = 0 AND used(o) = 0 AND used(d) = 0 THEN
IF o <> x AND o <> d AND x <> d AND o <> n AND x <> n AND d <> n THEN
used(n) = 1: used(o) = 1: used(x) = 1: used(d) = 1
FOR a = 1 TO 26
z = 18 - a
c = 10 - a
IF z > 0 AND z < 27 AND c > 0 AND c < 27 THEN
IF used(a) = 0 AND used(z) = 0 AND used(c) = 0 THEN
IF a <> z AND a <> c AND z <> c THEN
used(a) = 1: used(c) = 1: used(z) = 1
FOR k = 1 TO 26
j = 14 - k
y = 23 - k
IF j > 0 AND j < 27 AND y > 0 AND y < 27 THEN
IF used(k) = 0 AND used(j) = 0 AND used(y) = 0 AND k <> j AND j <> y AND k <> y THEN
used(k) = 1: used(j) = 1: used(y) = 1
r = 42 - c - y
t = 73 - o - r - e
w = 54 - a - l - k
IF r > 0 AND r < 27 AND t > 0 AND t < 27 AND w > 0 AND w < 27 THEN
IF used(r) = 0 AND used(t) = 0 AND used(w) = 0 THEN
used(r) = 1: used(t) = 1: used(w) = 1
FOR m = 1 TO 26
v = m + 4
h = 40 - a - v - e
IF v > 0 AND v < 27 AND h > 0 AND h < 27 THEN
IF used(m) = 0 AND used(v) = 0 AND used(h) = 0 THEN
IF m <> v AND m <> h AND v <> h THEN
used(m) = 1: used(v) = 1: used(h) = 1
FOR g = 1 TO 26
b = 39 - g
IF b > 0 AND b < 27 THEN
IF used(g) = 0 AND used(b) = 0 THEN
used(b) = 1: used(g) = 1
FOR f = 1 TO 26
i = 11 - f
IF i > 0 AND i < 27 THEN
IF used(f) = 0 AND used(i) = 0 THEN
used(f) = 1: used(i) = 1
u = 51 - g - n
q = 40 - u - i - t
IF q > 0 AND q < 27 THEN
IF used(u) = 0 AND used(q) = 0 THEN
used(u) = 1: used(q) = 1
s = 51 - v - a - t
p = 47 - a - l - m
IF s > 0 AND s < 27 AND p > 0 AND p < 27 THEN
IF used(p) = 0 AND used(s) = 0 THEN
PRINT " a b c d e f g h i j k l m n o p q r s t u v w x y z"
PRINT USING "###"; a; b; c; d; e; f; g; h; i; j; k; l; m; n; o; p; q; r; s; t; u; v; w; x; y; z
ct = ct + 1
END IF
END IF
used(u) = 0: used(q) = 0
END IF
END IF
used(f) = 0: used(i) = 0
END IF
END IF
NEXT f
used(b) = 0: used(g) = 0
END IF
END IF
NEXT g
used(m) = 0: used(v) = 0: used(h) = 0
END IF
END IF
END IF
NEXT m
used(r) = 0: used(t) = 0: used(w) = 0
END IF
END IF
used(k) = 0: used(j) = 0: used(y) = 0
END IF
END IF
NEXT k
used(a) = 0: used(c) = 0: used(z) = 0
END IF
END IF
END IF
NEXT a
used(n) = 0: used(o) = 0: used(x) = 0: used(d) = 0
END IF
END IF
END IF
NEXT n
PRINT ct
producing the letter list:
a b c d e f g h i j k l m n o p q r s t u v w x y z
8 25 2 12 20 4 14 3 7 13 1 19 5 21 24 15 6 18 23 11 16 9 26 17 22 10
|
Posted by Charlie
on 2013-12-03 11:28:24 |