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

Home > Logic
Gender and Occupation (Posted on 2012-10-22) Difficulty: 2 of 5
A member of a medical staff makes the following statements each of which is truthful:
  1. The hospital staff consists of sixteen doctors and nurses, including me.
  2. 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?

No Solution Yet Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

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

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
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information