A member of a medical staff makes the following statements each of which is truthful:
- The hospital staff consists of sixteen doctors and nurses, including me.
- The following facts apply to the staff members; whether you include me or not does
not make any difference. The staff consists of:
- More nurses than doctors.
- More male doctors than male nurses.
- More male nurses than female nurses.
- At least one female doctor.
What is the gender and occupation of the speaker?
CLS
FOR docs = 1 TO 7
nurses = 16 - docs
FOR fdocs = 1 TO docs
mdocs = docs - fdocs
FOR fmnurses = 0 TO INT((nurses - 1) / 2)
mnurses = nurses - fmnurses
xfnurses = fmnurses
xmnurses = mnurses
xfdocs = fdocs
xmdocs = mdocs
xfnurses = fmnurses - 1
GOSUB checkIt
xfnurses = fmnurses
xmnurses = mnurses - 1
GOSUB checkIt
xmnurses = mnurses
xfdocs = fdocs - 1
GOSUB checkIt
xfdocs = fdocs
xmdocs = mdocs - 1
GOSUB checkIt
xmdocs = mdocs
NEXT fmnurses
NEXT fdocs
NEXT docs
END
checkIt:
good = 1
IF nurses <= docs OR xmnurses + xfnurses <= xfdocs + xmdocs THEN good = 0
IF mdocs <= mnurses OR xmdocs <= xmnurses THEN good = 0
IF mnurses <= fmnurses OR xmnurses <= xfnurses THEN good = 0
IF fdocs = 0 OR xfdocs = 0 THEN good = 0
IF good THEN
PRINT "mn fn md fd"
PRINT mnurses; fmnurses; mdocs; fdocs, xmnurses; xfnurses; xmdocs; xfdocs
END IF
RETURN
finds
mn fn md fd
5 4 6 1 5 3 6 1
meaning that in the sequence: male and female nurses, then male and female doctors, if you include the speaker the counts are:
5 4 6 1
If you exclude the speaker the counts are:
5 3 6 1
so the speaker is a female nurse.
|
Posted by Charlie
on 2012-10-22 12:36:08 |