All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Dart Discharge (Posted on 2013-11-07)
Three men - Art, Ben and Cal, played a dart game.
1. Each dart that lodged in the game board scored 1, 5, 10, 25, 50 or 100 points.
2. Each man threw nine darts that lodged in the board.
3. Each man's total score was the same as any other man's total score.
4. No number of points scored by a dart was scored by more than one man.
5. Art scored all the 5s and Ben scored all the 10s.
Who scored all the 100s?

 See The Solution Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 1 of 2

OPEN "dartscor.txt" FOR OUTPUT AS #2

FOR ones = 0 TO 9
FOR fives = 0 TO 9 - ones
v5 = 5 * fives
FOR tens = 0 TO 9 - ones - fives
v10 = 10 * tens
FOR twenty5s = 0 TO 9 - ones - fives - tens
v25 = 25 * twenty5s
FOR fiftys = 0 TO 9 - ones - fives - tens - twenty5s
hundreds = 9 - ones - fives - tens - twenty5s - fiftys
value = ones + v5 + v10 + v25 + 50 * fiftys + 100 * hundreds
PRINT #2, USING "####  "; value;
PRINT #2, USING "##"; ones; fives; tens; twenty5s; fiftys; hundreds
NEXT
NEXT
NEXT
NEXT
NEXT
CLOSE

SHELL "sort < dartscor.txt > dartscr.txt"

OPEN "dartscr.txt" FOR INPUT AS #1
OPEN "dartscor.txt" FOR OUTPUT AS #2

DIM hold\$(30)

DO
LINE INPUT #1, l\$
v = VAL(LEFT\$(l\$, 4))
IF v <> prev THEN
IF vct > 2 THEN
FOR a = 1 TO vct - 2
FOR b = a + 1 TO vct - 1
FOR c = b + 1 TO vct
good = 1
FOR psn = 8 TO 18 STEP 2
nzct = 0
IF MID\$(hold\$(a), psn, 1) <> "0" THEN nzct = nzct + 1
IF MID\$(hold\$(b), psn, 1) <> "0" THEN nzct = nzct + 1
IF MID\$(hold\$(c), psn, 1) <> "0" THEN nzct = nzct + 1
IF nzct > 1 THEN good = 0: EXIT FOR
NEXT psn
IF good THEN
PRINT #2, hold\$(a)
PRINT #2, hold\$(b)
PRINT #2, hold\$(c)
PRINT #2,
END IF
NEXT
NEXT
NEXT
END IF
vct = 1
hold\$(1) = l\$
ELSE
vct = vct + 1
hold\$(vct) = l\$
END IF
prev = v
LOOP UNTIL EOF(1)
CLOSE

(variables a, b and c are not necessarily the respective names Art, Ben and Cal)

finds

225   0 0 0 9 0 0
225   0 5 0 0 4 0
225   5 0 2 0 0 2

Annotated, based on spec 5, this is

`value: 1  5 10 25 50 100 225   0  0  0  9  0  0   Cal 225   0  5  0  0  4  0   Art 225   5  0  2  0  0  2   Ben`

So Ben scored all the 100s.

 Posted by Charlie on 2013-11-07 11:39:56

 Search: Search body:
Forums (0)