Mowing a lawn 5 acres in size is part of a community service project. A group of people, including boys, girls, ladies and men, take up the job. They continue until the job is done. It is assumed that the job is the same regardless of how many days taken: i.e., there is no appreciable growth of grass.
a) 3 boys and 8 ladies can do the job in 3 days.
b) 8 girls & 2 men can do it in 4 days, which is the same as the time taken by 2 men and 6 boys.
c) 3 boys can do the job as fast as 2 men.
One day they reach the place of work and find that there are four bowls containing pills kept for each category. (Marked- Boys, Girls, Ladies & Men). Two of these bowls contain poison pills and two contain energy pills. After consuming a poison pill their rate reduces to one third and after consuming an energy pill their rate becomes double.
In all, eight persons are present and there is at least one member from each category. They each take one pill from their respective bowl and start working. The job was completed in 6 days and the number of girls is not more than the number of boys. How many boys, girls, ladies and men were present and which pill did they have?
3 B + 8 L = 1/3 (all in jobs per day)
8 G + 2 M = 1/4
2 M + 6 B = 1/4
3 B = 2 M
9 B = 1/4
B = 1/36 (one boy takes 36 days)
M = 3/72 = 1/24 (one man takes 24 days)
8 G + 1/12 = 1/4
8 G = 2/12 = 1/6
G = 1/48 (one girl takes 48 days)
1/12 + 8 L = 1/3
8 L = 1/4
L = 1/32 (one lady takes 32 days)
Then the program:
DECLARE SUB permute (a$)
CLS
DEFDBL A-Z
bv = 1 / 36
gv = 1 / 48
lv = 1 / 32
mv = 1 / 24
FOR b = 1 TO 5
FOR g = 1 TO 7 - b
FOR l = 1 TO 7 - b - g
m = 8 - b - g - l
p$ = "ppee": h$ = p$
DO
IF MID$(p$, 1, 1) = "p" THEN t = b * bv / 3: ELSE t = b * bv * 2
IF MID$(p$, 2, 1) = "p" THEN t = t + g * gv / 3: ELSE t = t + g * gv * 2
IF MID$(p$, 3, 1) = "p" THEN t = t + l * lv / 3: ELSE t = t + l * lv * 2
IF MID$(p$, 4, 1) = "p" THEN t = t + m * mv / 3: ELSE t = t + m * mv * 2
IF ABS(1 / t - 6) < .00000001# THEN
PRINT "b g l m"; 1 / t
PRINT b; g; l; m
PRINT p$
PRINT
END IF
permute p$
LOOP UNTIL p$ = h$
NEXT
NEXT
NEXT
(the subroutine permute is found elsewhere on the site)
finds
b g l m 6.000000000000002
1 1 4 2
e e p p
b g l m 5.999999999999999
1 5 1 1
e p e p
The second solution has more girls than boys, so we need the first solution, with 1 boy, 1 girl, 4 ladies and 2 men. The ladies and the men have taken poison pills while the boy and the girl have taken energy pills. Rounding problems in conversion to and from binary are the cause of the non-exact values representing 6.
|
Posted by Charlie
on 2006-05-23 15:44:10 |