Paul the postal carrier had an unusual week involving the ten properties along Park Place. Each day of the week Monday through Saturday he delivered mail to four houses. Eight of the houses received mail on three days and two houses got no mail.
The houses along Park Place are numbered 1 to 10. The sum of the house numbers Paul delivered for each day of the week were:
- Monday: 12
- Tuesday: 18
- Wednesday: 23
- Thursday: 32
- Friday: 25
- Saturday: 19
Which two houses did not receive mail?
(In reply to
computer solutions by Daniel)
The 13 ways of getting the same unserved mailboxes:
1 2 3 6 1 2 3 6 1 2 3 6 1 2 3 6 1 2 3 6
1 2 5 10 1 2 5 10 1 2 5 10 1 2 5 10 1 2 5 10
1 5 7 10 1 6 7 9 2 5 7 9 2 5 7 9 3 5 6 9
6 7 9 10 6 7 9 10 6 7 9 10 6 7 9 10 6 7 9 10
3 6 7 9 3 5 7 10 3 5 7 10 3 6 7 9 3 5 7 10
2 3 5 9 2 3 5 9 1 3 6 9 1 3 5 10 1 2 7 9
4 8 4 8 4 8 4 8 4 8
1 2 3 6 1 2 3 6 1 2 3 6 1 2 3 6 1 2 3 6
1 2 6 9 1 2 6 9 1 3 5 9 1 3 5 9 1 3 5 9
1 5 7 10 2 5 7 9 1 5 7 10 2 5 6 10 2 5 7 9
6 7 9 10 6 7 9 10 6 7 9 10 6 7 9 10 6 7 9 10
3 5 7 10 3 5 7 10 2 6 7 10 3 5 7 10 2 6 7 10
2 3 5 9 1 3 5 10 2 3 5 9 1 2 7 9 1 3 5 10
4 8 4 8 4 8 4 8 4 8
1 2 3 6 1 2 3 6 1 2 3 6
1 3 5 9 2 3 6 7 2 3 6 7
2 5 7 9 1 5 7 10 2 5 7 9
6 7 9 10 6 7 9 10 6 7 9 10
3 5 7 10 1 5 9 10 1 5 9 10
1 2 6 10 2 3 5 9 1 3 5 10
4 8 4 8 4 8
DECLARE SUB deliver (day!)
DIM SHARED noHseUsed, houseCt(10), dayCt(6), hist(6, 4), solCt
CLS
DATA 12,18,23,32,25,19
FOR i = 1 TO 6
READ dayCt(i)
NEXT
deliver 1
PRINT solCt
END
SUB deliver (day)
FOR h1 = 1 TO 7
IF houseCt(h1) < 3 AND (noHseUsed < 8 OR houseCt(h1) > 0) THEN
houseCt(h1) = houseCt(h1) + 1
IF houseCt(h1) = 1 THEN noHseUsed = noHseUsed + 1
FOR h2 = h1 + 1 TO 8
IF houseCt(h2) < 3 AND (noHseUsed < 8 OR houseCt(h2) > 0) THEN
houseCt(h2) = houseCt(h2) + 1
IF houseCt(h2) = 1 THEN noHseUsed = noHseUsed + 1
FOR h3 = h2 + 1 TO 9
IF houseCt(h3) < 3 AND (noHseUsed < 8 OR houseCt(h3) > 0) THEN
houseCt(h3) = houseCt(h3) + 1
IF houseCt(h3) = 1 THEN noHseUsed = noHseUsed + 1
h4 = dayCt(day) - h1 - h2 - h3
IF h4 > h3 AND h4 <= 10 THEN
IF houseCt(h4) < 3 AND (noHseUsed < 8 OR houseCt(h4) > 0) THEN
houseCt(h4) = houseCt(h4) + 1
IF houseCt(h4) = 1 THEN noHseUsed = noHseUsed + 1
hist(day, 1) = h1
hist(day, 2) = h2
hist(day, 3) = h3
hist(day, 4) = h4
IF day = 6 THEN
r0 = (solCt \ 5) * 10 + 1
c0 = (solCt MOD 5) * 15 + 1
FOR i = 1 TO 6
FOR j = 1 TO 4
LOCATE r0 + i, c0 + (j - 1) * 3
PRINT USING " ##"; hist(i, j);
NEXT
PRINT
NEXT
solCt = solCt + 1
LOCATE r0 + i, c0
FOR i = 1 TO 10
IF houseCt(i) = 0 THEN PRINT i;
NEXT
PRINT : PRINT : PRINT
ELSE
deliver day + 1
END IF
houseCt(h4) = houseCt(h4) - 1
IF houseCt(h4) = 0 THEN noHseUsed = noHseUsed - 1
END IF
END IF
houseCt(h3) = houseCt(h3) - 1
IF houseCt(h3) = 0 THEN noHseUsed = noHseUsed - 1
END IF
NEXT h3
houseCt(h2) = houseCt(h2) - 1
IF houseCt(h2) = 0 THEN noHseUsed = noHseUsed - 1
END IF
NEXT h2
houseCt(h1) = houseCt(h1) - 1
IF houseCt(h1) = 0 THEN noHseUsed = noHseUsed - 1
END IF
NEXT h1
END SUB
|
Posted by Charlie
on 2009-11-17 14:32:59 |