Consider the values of the individual letters in
Numbered Letters in their original order.
What are the English words that have a total letter value of exactly 100 when you add up all of the letters, whenever:
(I) Each of the letters in the odd positions have the same values as in the original system, but the letters in the even positions are assigned the values in reverse order (a=1, b=26, c=3, d=24, e=5, f=22, ..., y=25, z=2)?
(II) Each of the the letters in the even positions have the same values as in the original system, but the letters in the odd positions are assigned the values in reverse order(a=25, b=2, c=23, d=4, e=21, f=6, ..., y=1, z=26)?
this assumes that "odd positions" and "even positions" refer only to positions within the alphabet, rather than positions within the word, as shown by the parenthetical explanations.
DIM t1(26), t2(26)
OPEN "\words\words.txt" FOR INPUT AS #1
OPEN "numlet2a.txt" FOR OUTPUT AS #2
OPEN "numlet2b.txt" FOR OUTPUT AS #3
DO
LINE INPUT #1, l1$
l$ = LCASE$(l1$)
IF l$ = l1$ THEN
tot1 = 0: tot2 = 0
FOR i = 1 TO LEN(l$)
v = INSTR("abcdefghijklmnopqrstuvwxyz", MID$(l$, i, 1))
IF v MOD 2 = 1 THEN
tot1 = tot1 + v: t1(i) = v
tot2 = tot2 + 26 - v: t2(i) = 26 - v
ELSE
tot1 = tot1 + 28 - v: t1(i) = 28 - v
tot2 = tot2 + v: t2(i) = v
END IF
NEXT
IF tot1 = 100 THEN
PRINT l1$: PRINT #2, l1$;
' FOR i = 1 TO LEN(l$)
' PRINT #2, t1(i);
' NEXT
PRINT #2,
END IF
IF tot2 = 100 THEN
PRINT " "; l1$: PRINT #3, l1$;
' FOR i = 1 TO LEN(l$)
' PRINT #3, t2(i);
' NEXT
PRINT #3,
END IF
END IF
LOOP UNTIL EOF(1)
CLOSE
|
Posted by Charlie
on 2011-05-09 14:45:34 |