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

 Four Cards (Posted on 2014-04-10)
1. Five friends Alice, Ben, Carla, Dan, Ellen and Frank guess at four aces.
2. Although nobody gets all answers right, there is a clear winner.
3. Two people are tied for second-best score, and two others are tied for third-best score.
The guesses are as follows:
```        1st Card      2nd Card    3rd Card    4th Card
Ben       Heart       Diamond     Diamond     Club
What are the four cards?

 No Solution Yet Submitted by K Sengupta No Rating

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

DECLARE SUB permute (a\$)
CLS
DATA sscd,hddc,dchs,dhsc,hscd,csdh

a\$ = "schd": h\$ = a\$
DO
REDIM score(6), sc(4)
RESTORE
FOR i = 1 TO 6
ct = 0
FOR j = 1 TO 4
IF MID\$(a\$, j, 1) = MID\$(g\$, j, 1) THEN ct = ct + 1
NEXT
score(i) = ct
sc(ct) = sc(ct) + 1
NEXT
s\$ = ""
FOR i = 0 TO 4
IF sc(i) > 0 THEN
s\$ = s\$ + LTRIM\$(STR\$(sc(i)))
END IF
NEXT
IF s\$ = "1221" THEN
PRINT a\$,
FOR i = 1 TO 6
PRINT score(i);
NEXT: PRINT
END IF
permute a\$
LOOP UNTIL a\$ = h\$

finds

hsdc          1  3  0  1  2  2

indicating the correct sequence of Hearts, Spades, Diamonds, Clubs.

The guess sets of Alice, Ben, Carla, Dan, Ellen and Frank, in order, had:

1, 3, 0, 1, 2, and 2 correct guesses.

 Posted by Charlie on 2014-04-10 14:58:10

 Search: Search body:
Forums (0)
Random Problem
Site Statistics
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox: