The inhabitants of Ganymede are all infamous for being either knights, liars or knaves. At the spaceport, four flight schedulers with Jovian Galactic Corp. were up-dating their manager on which two inter-lunar shuttles had the best and worst ‘on-time’ departure records the previous month (about 7 Earth days).
From the following discussion, what type of Ganymedan are each of the four, and which two of the fleets' 21 shuttles (each assigned a different two-digit prime number) scored the best and worst departure ratings?
1) B. "The two numbers are less than and greater than 50 respectively."
2) C. "B. is a liar."
3) D. "The difference between the two numbers is a square."
4) A. "The difference between the two numbers is a two digit palindrome."
5) C. "The difference between the two numbers is an odd number."
6) A. "The sum of the two numbers is greater than 100."
7) B. "The sums of the two digits in each number are both primes."
8) D. "The average of the two numbers is even."
9) A. "D. is a liar."
10) C. "The sums of the two digits in each number are both even."
11) D. "C. is a knave."
12) B. "The sum of the two numbers is less than 100."
13) C. "The two numbers are both above 50."
14) D. "The two numbers are both below 50."
15) B. "The average of the two numbers is odd."
16) A. "The shuttle with the best ‘on-time’ departure rating has the higher number."
DATA 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47 , 53 , 59
DATA 61 , 67 , 71 , 73 , 79 , 83 , 89 , 97
DIM pr(21)
CLS
FOR i = 1 TO 21: READ pr(i): NEXT: PRINT
FOR a = -1 TO 1' -1=liar; 0=knave; 1=knight
FOR b = -1 TO 1
FOR c = -1 TO 1
FOR d = -1 TO 1
FOR ibest = 1 TO 21
best = pr(ibest)
FOR iworst = 1 TO 21
worst = pr(iworst)
IF best <> worst THEN
IF best < 50 AND worst > 50 OR best > 50 AND worst < 50 THEN b1 = 1: ELSE b1 = 0
IF b1 = 1 AND b = -1 OR b1 = 0 AND b = 1 THEN GOTO notThis
IF c = 1 AND b <> -1 OR c = -1 AND b = -1 THEN GOTO notThis
IF b = -1 THEN c1 = 1: ELSE c1 = 0
sq = ABS(best - worst)
sr = INT(SQR(sq) + .5)
IF sr * sr = sq THEN d1 = 1: ELSE d1 = 0
IF d1 = 1 AND d = -1 OR d1 = 0 AND d = 1 THEN GOTO notThis
s$ = LTRIM$(STR$(sq))
IF LEFT$(s$, 1) = RIGHT$(s$, 1) THEN a1 = 1: ELSE a1 = 0
IF a1 = 1 AND a = -1 OR a1 = 0 AND a = 1 THEN GOTO notThis
IF sq MOD 2 = 1 THEN c2 = 1: ELSE c2 = 0
IF c2 = 1 AND c = -1 OR c2 = 0 AND c = 1 THEN GOTO notThis
IF best + worst > 100 THEN a2 = 1: ELSE a2 = 0
IF a2 = 1 AND a = -1 OR a2 = 0 AND a = 1 THEN GOTO notThis
sum1 = best \ 10 + (best MOD 10)
sum2 = worst \ 10 + (worst MOD 10)
IF sum1 = 2 OR sum1 = 3 OR sum1 = 5 OR sum1 = 7 OR sum1 = 11 OR sum1 = 13 OR sum1 = 17 THEN b2 = 1: ELSE b2 = 0
IF sum2 <> 2 AND sum2 <> 3 AND sum2 <> 5 AND sum2 <> 7 AND sum2 <> 11 AND sum2 <> 13 AND sum2 <> 17 THEN b2 = 0
IF b2 = 1 AND b = -1 OR b2 = 0 AND b = 1 THEN GOTO notThis
IF (best + worst) MOD 4 = 0 THEN d2 = 1: ELSE d2 = 0
IF d2 = 1 AND d = -1 OR d2 = 0 AND d = 1 THEN GOTO notThis
IF d = -1 THEN a3 = 1: ELSE a3 = 0
IF a3 = 1 AND a = -1 OR a3 = 0 AND a = 1 THEN GOTO notThis
IF sum1 MOD 2 = 0 AND sum2 MOD 2 = 0 THEN c3 = 1: ELSE c3 = 0
IF c3 = 1 AND c = -1 OR c3 = 0 AND c = 1 THEN GOTO notThis
IF c = 0 THEN d3 = 1: ELSE d3 = 0
IF d3 = 1 AND d = -1 OR d3 = 0 AND d = 1 THEN GOTO notThis
IF best + worst < 100 THEN b3 = 1: ELSE b3 = 0
IF b3 = 1 AND b = -1 OR b3 = 0 AND b = 1 THEN GOTO notThis
IF best > 50 AND worst > 50 THEN c4 = 1: ELSE c4 = 0
IF c4 = 1 AND c = -1 OR c4 = 0 AND c = 1 THEN GOTO notThis
IF best < 50 AND worst < 50 THEN d4 = 1: ELSE d4 = 0
IF d4 = 1 AND d = -1 OR d4 = 0 AND d = 1 THEN GOTO notThis
IF (best + worst) MOD 4 = 2 THEN b4 = 1: ELSE b4 = 0
IF b4 = 1 AND b = -1 OR b4 = 0 AND b = 1 THEN GOTO notThis
IF best > worst THEN a4 = 1: ELSE a4 = 0
IF a4 = 1 AND a = -1 OR a4 = 0 AND a = 1 THEN GOTO notThis
IF a = 0 THEN
IF a1 <> a3 OR a2 <> a4 OR a1 = a2 OR a3 = a4 THEN GOTO notThis
END IF
IF b = 0 THEN
IF b1 <> b3 OR b2 <> b4 OR b1 = b2 OR b3 = b4 THEN GOTO notThis
END IF
IF c = 0 THEN
IF c1 <> c3 OR c2 <> c4 OR c1 = c2 OR c3 = c4 THEN GOTO notThis
END IF
IF d = 0 THEN
IF d1 <> d3 OR d2 <> d4 OR d1 = d2 OR d3 = d4 THEN GOTO notThis
END IF
PRINT a; b; c; d, best; worst
notThis:
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
finds
0 1 -1 -1 23 67
which, according to 0 = knave, 1 = knight and -1 = liar, indicates that
A is a knave
B is a knight
C and D are liars
and the best shuttle is #23 and the worst is #67.
|
Posted by Charlie
on 2011-03-18 01:49:03 |