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

 The hired man (Posted on 2005-12-19)
Alden, Brent, Craig and David applied for a job that required the applicant:

- to be a high school graduate.
- to have at least two years of previous work.
- to be a veteran.
- to have satisfactory references.

One of them, who met more of the requirements than any of the others, was hired.

1) Each of the six possible pairs of requirements was met by exactly one man.
2) Alden and Brent are high school graduate.
3) Craig and David have at least two years of previous work.
4) Brent and Craig were both veterans.

Who was hired?

 See The Solution Submitted by pcbouhid Rating: 3.5000 (6 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Computer Solution -- spoiler | Comment 4 of 20 |

The people and their qualifications are as follows:

`  HS 2Y VET REFA  1  1  0   0B  1  0  1   1C  0  1  1   0D  0  1  0   1`

so that B had the most qualifications and was hired.

The program is as follows, treating sets of qualifications as binary numbers, where HS grad had value 8; 2-yr exp, 4; veteran, 2 and references, 1.

DATA 3,5,6,9,10,12
CLS

FOR i = 1 TO 6: READ pair(i): NEXT
FOR a = 8 TO 15
FOR b = 8 TO 15
IF b AND 2 THEN
FOR c = 0 TO 15
IF (c AND 6) = 6 THEN
FOR d = 0 TO 15
IF (d AND 5) = 5 THEN
good = 1
FOR p = 1 TO 6
ct = 0
IF (a AND pair(p)) = pair(p) THEN ct = ct + 1
IF (b AND pair(p)) = pair(p) THEN ct = ct + 1
IF (c AND pair(p)) = pair(p) THEN ct = ct + 1
IF (d AND pair(p)) = pair(p) THEN ct = ct + 1
IF ct <> 1 THEN good = 0
NEXT
IF good THEN
x = a: s\$ = ""
FOR i = 1 TO 4
s\$ = STR\$(x MOD 2) + s\$
x = x \ 2
NEXT
PRINT s\$
x = b: s\$ = ""
FOR i = 1 TO 4
s\$ = STR\$(x MOD 2) + s\$
x = x \ 2
NEXT
PRINT s\$
x = c: s\$ = ""
FOR i = 1 TO 4
s\$ = STR\$(x MOD 2) + s\$
x = x \ 2
NEXT
PRINT s\$
x = d: s\$ = ""
FOR i = 1 TO 4
s\$ = STR\$(x MOD 2) + s\$
x = x \ 2
NEXT
PRINT s\$
END IF
END IF
NEXT
END IF
NEXT
END IF
NEXT
NEXT

 Posted by Charlie on 2005-12-19 14:16:30

 Search: Search body:
Forums (0)