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

Home > Logic
Mail Delivery Muse (Posted on 2013-06-11) Difficulty: 3 of 5
Postman Nat delivers the mail in a small village which has only one street with exactly ten houses, numbered from 1 up to and including 10.

In a certain week, Nat did not deliver any mail at two houses in the village; at the other houses he delivered mail three times each. Each working day he delivered mail at exactly four houses.

The sums of the house numbers where he delivered mail were:
on Monday: 18
on Tuesday: 12
on Wednesday: 23
on Thursday: 19
on Friday: 32
op Saturday: 25
on Sunday: he never works
Which two houses didn't get any mail that week?

No Solution Yet Submitted by K Sengupta    
Rating: 2.5000 (2 votes)

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

Houses 4 and 8 received no mail that week.

The first line in each pair of lines below is the same, indicating the number of mail deliveries in houses 1 to 10 in order. The second of the two lines is the day-by-day itinerary of the postman; there are 13 possible arrangements of these.

3  3  3  0  3  3  3  0  3  3
 1  2  5 10 |  1  2  3  6 |  1  5  7 10 |  2  3  5  9 |  6  7  9 10 |  3  6  7  9

3  3  3  0  3  3  3  0  3  3
 1  2  5 10 |  1  2  3  6 |  1  6  7  9 |  2  3  5  9 |  6  7  9 10 |  3  5  7 10

3  3  3  0  3  3  3  0  3  3
 1  2  5 10 |  1  2  3  6 |  2  5  7  9 |  1  3  5 10 |  6  7  9 10 |  3  6  7  9

3  3  3  0  3  3  3  0  3  3
 1  2  5 10 |  1  2  3  6 |  2  5  7  9 |  1  3  6  9 |  6  7  9 10 |  3  5  7 10

3  3  3  0  3  3  3  0  3  3
 1  2  5 10 |  1  2  3  6 |  3  5  6  9 |  1  2  7  9 |  6  7  9 10 |  3  5  7 10

3  3  3  0  3  3  3  0  3  3
 1  2  6  9 |  1  2  3  6 |  1  5  7 10 |  2  3  5  9 |  6  7  9 10 |  3  5  7 10

3  3  3  0  3  3  3  0  3  3
 1  2  6  9 |  1  2  3  6 |  2  5  7  9 |  1  3  5 10 |  6  7  9 10 |  3  5  7 10

3  3  3  0  3  3  3  0  3  3
 1  3  5  9 |  1  2  3  6 |  1  5  7 10 |  2  3  5  9 |  6  7  9 10 |  2  6  7 10

3  3  3  0  3  3  3  0  3  3
 1  3  5  9 |  1  2  3  6 |  2  5  6 10 |  1  2  7  9 |  6  7  9 10 |  3  5  7 10

3  3  3  0  3  3  3  0  3  3
 1  3  5  9 |  1  2  3  6 |  2  5  7  9 |  1  2  6 10 |  6  7  9 10 |  3  5  7 10

3  3  3  0  3  3  3  0  3  3
 1  3  5  9 |  1  2  3  6 |  2  5  7  9 |  1  3  5 10 |  6  7  9 10 |  2  6  7 10

3  3  3  0  3  3  3  0  3  3
 2  3  6  7 |  1  2  3  6 |  1  5  7 10 |  2  3  5  9 |  6  7  9 10 |  1  5  9 10

3  3  3  0  3  3  3  0  3  3
 2  3  6  7 |  1  2  3  6 |  2  5  7  9 |  1  3  5 10 |  6  7  9 10 |  1  5  9 10
 
The program assumes the two house numbers for non-delivery add up to 12 so that the total of Monday's through Saturday's deliveries adds up to 36 less than three times the sum of the numbers 1 through 10.

DECLARE SUB deliver (day!)
DIM SHARED nd1, nd2, dels(10), hist(30, 4), solct
CLS
FOR nd1 = 2 TO 5
  nd2 = 12 - nd1
  deliver 1
NEXT

SUB deliver (day)
  FOR h1 = 1 TO 7
    IF h1 <> nd1 AND h1 <> nd2 AND dels(h1) < 3 THEN
    FOR h2 = h1 + 1 TO 8
      IF h2 <> nd1 AND h2 <> nd2 AND dels(h2) < 3 THEN
      FOR h3 = h2 + 1 TO 9
        IF h3 <> nd1 AND h3 <> nd2 AND dels(h3) < 3 THEN
        FOR h4 = h3 + 1 TO 10
          IF h4 <> nd1 AND h4 <> nd2 AND dels(h4) < 3 THEN
             tot = h1 + h2 + h3 + h4
             good = 0
             SELECT CASE day
               CASE 1: IF tot = 18 THEN good = 1
               CASE 2: IF tot = 12 THEN good = 1
               CASE 3: IF tot = 23 THEN good = 1
               CASE 4: IF tot = 19 THEN good = 1
               CASE 5: IF tot = 32 THEN good = 1
               CASE 6: IF tot = 25 THEN good = 1
             END SELECT
             IF good THEN
               dels(h1) = dels(h1) + 1
               dels(h2) = dels(h2) + 1
               dels(h3) = dels(h3) + 1
               dels(h4) = dels(h4) + 1
               hist(day, 1) = h1
               hist(day, 2) = h2
               hist(day, 3) = h3
               hist(day, 4) = h4
               IF day = 6 THEN
                 FOR i = 1 TO 10
                   PRINT dels(i);
                 NEXT
                 PRINT
                 FOR d = 1 TO 6
                  FOR i = 1 TO 4
                    PRINT USING " ##"; hist(d, i);
                  NEXT: IF d < 6 THEN PRINT "|";
                 NEXT: PRINT : PRINT
               ELSE
                 deliver day + 1
               END IF
              
               dels(h1) = dels(h1) - 1
               dels(h2) = dels(h2) - 1
               dels(h3) = dels(h3) - 1
               dels(h4) = dels(h4) - 1
             END IF
          END IF
        NEXT h4
        END IF
      NEXT h3
      END IF
    NEXT h2
    END IF
  NEXT h1
END SUB

 


  Posted by Charlie on 2013-06-11 17:24:10
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 (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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