A festival was held each autumn by the Minikins, and there was much feasting and many contests. At one such time, Ekum, Elfum, Eskum, and Evum each won a first place in one of these events: acorn gathering, dancing, singing, and huckleberry eating; not necessarily in that order.
Curiously, each winner also won a second place and a third place in two other of these four events. From the statements below find out who won first place, who won second place, and who won third place in each of the four events.
- The one who placed second in huckleberry eating was third in dancing.
- The winner of the singing contest placed third in huckleberry eating.
- Evum did not place first in acorn gathering or dancing.
- Evum was a close second place behind Eskum in one of the four events.
- Elfum placed third in singing, but did not place in acorn gathering, and was not first in dancing.
DECLARE SUB show (a$)
DECLARE SUB permute (a$)
CLS
DIM SHARED name$(4)
name$(1) = "Ekum"
name$(2) = "Elfum"
name$(3) = "Eskum"
name$(4) = "Evum"
acorn$ = "klsv": ha$ = acorn$
good = 1
DO
dance$ = "klsv": hd$ = dance$
DO
good = 1
FOR i = 1 TO 4
IF MID$(acorn$, i, 1) = MID$(dance$, i, 1) THEN good = 0
NEXT
IF good THEN
sing$ = "klsv": hs$ = sing$
DO
good = 1
FOR i = 1 TO 4
IF MID$(acorn$, i, 1) = MID$(sing$, i, 1) THEN good = 0
IF MID$(dance$, i, 1) = MID$(sing$, i, 1) THEN good = 0
NEXT
IF good THEN
huckle$ = "klsv": hh$ = huckle$
DO
good = 1
FOR i = 1 TO 4
IF MID$(acorn$, i, 1) = MID$(huckle$, i, 1) THEN good = 0
IF MID$(dance$, i, 1) = MID$(huckle$, i, 1) THEN good = 0
IF MID$(sing$, i, 1) = MID$(huckle$, i, 1) THEN good = 0
NEXT
IF good THEN
IF MID$(huckle$, 2, 1) = MID$(dance$, 3, 1) THEN
IF MID$(sing$, 1, 1) = MID$(huckle$, 3, 1) THEN
IF MID$(acorn$, 1, 1) <> "v" AND MID$(dance$, 1, 1) <> "v" THEN
IF (LEFT$(acorn$, 2) = "sv") + (LEFT$(dance$, 2) = "sv") + (LEFT$(sing$, 2) = "sv") + (LEFT$(huckle$, 2) = "sv") = -1 THEN
IF MID$(sing$, 3, 1) = "l" AND MID$(dance$, 1, 1) <> "l" THEN
IF INSTR(acorn$, "l") > 2 THEN
PRINT "acorn gathering:"; : show acorn$
PRINT "dancing:"; : show dance$
PRINT "singing:"; : show sing$
PRINT "huckleberry eating:"; : show huckle$
PRINT
END IF
END IF
END IF
END IF
END IF
END IF
END IF
permute huckle$
LOOP UNTIL huckle$ = hh$
END IF
permute sing$
LOOP UNTIL sing$ = hs$
END IF
permute dance$
LOOP UNTIL dance$ = hd$
permute acorn$
LOOP UNTIL acorn$ = ha$
DEFSNG A-Z
SUB show (a$)
FOR p = 1 TO 4
FOR i = 1 TO 4
IF MID$(name$(i), 2, 1) = MID$(a$, p, 1) THEN PRINT " "; name$(i);
NEXT
NEXT
PRINT
END SUB
finds these orders of finish:
acorn gathering: Eskum Evum Ekum Elfum
dancing: Ekum Elfum Eskum Evum
singing: Evum Ekum Elfum Eskum
huckleberry eating: Elfum Eskum Evum Ekum
|
Posted by Charlie
on 2013-04-29 18:18:57 |