In this 4x4 grid, each of the capital letters in bold represents a different base ten digit from 0 to 9, such that the sum of each of the four columns as well as the sum of each of the four rows is ET.
E L M S
R E I N
A N T I
S T E P
Determine the respective minimum value and the maximum value of ET.
Note: ET is equal to 10*E+ T.
1 2 9 4
8 1 0 7
3 7 6 0
4 6 1 5
16 1 6
1 9 2 4
8 1 7 0
3 0 6 7
4 6 1 5
16 1 6
1 3 9 2
8 1 0 6
4 6 5 0
2 5 1 7
15 1 5
1 9 3 2
8 1 6 0
4 0 5 6
2 5 1 7
15 1 5
1 6 7 0
8 1 2 3
5 3 4 2
0 4 1 9
14 1 4
1 7 6 0
8 1 3 2
5 2 4 3
0 4 1 9
14 1 4
totals of 14 through 16.
Only if E had been zero would there be a problem, for ET.
CLS
FOR e = 0 TO 9
IF used(e) = 0 THEN
used(e) = 1
FOR r = 0 TO 9
IF used(r) = 0 THEN
used(r) = 1
FOR a = 0 TO 9
IF used(a) = 0 THEN
used(a) = 1
FOR s = 0 TO 9
IF used(s) = 0 THEN
used(s) = 1
FOR l = 0 TO 9
IF used(l) = 0 THEN
used(l) = 1
FOR n = 0 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR t = 0 TO 9
IF used(t) = 0 THEN
used(t) = 1
FOR m = 0 TO 9
IF used(m) = 0 THEN
used(m) = 1
FOR i = 0 TO 9
IF used(i) = 0 THEN
used(i) = 1
FOR p = 0 TO 9
IF used(p) = 0 THEN
used(p) = 1
s1 = e + l + m + s
s2 = r + e + i + n
s3 = a + n + t + i
s4 = s + t + e + p
s5 = e + r + a + s
s6 = l + e + n + t
s7 = m + i + t + e
s8 = s + n + i + p
IF s1 = 10 * e + t AND s1 = s2 AND s2 = s3 AND s3 = s4 THEN
IF s4 = s5 AND s5 = s6 AND s6 = s7 AND s7 = s8 THEN
PRINT e; l; m; s
PRINT r; e; i; n
PRINT a; n; t; i
PRINT s; t; e; p
PRINT s1, e; t: PRINT
END IF
END IF
used(p) = 0
END IF
NEXT
used(i) = 0
END IF
NEXT
used(m) = 0
END IF
NEXT
used(t) = 0
END IF
NEXT
used(n) = 0
END IF
NEXT
used(l) = 0
END IF
NEXT
used(s) = 0
END IF
NEXT
used(a) = 0
END IF
NEXT
used(r) = 0
END IF
NEXT
used(e) = 0
END IF
NEXT
|
Posted by Charlie
on 2009-07-31 17:16:22 |