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

Home > Logic > Weights and Scales
Pumpkins 3 (Posted on 2014-01-22) Difficulty: 3 of 5
This is in continuation of Pumpkins and Pumpkins 2.

Six pumpkins - each having a different weight - are weighed two at a time in all 15 sets of two. The weights are recorded as: 27, 36, 39, 45, 48, 51, 54, 57, 63, 66, 72, 75 and 81 pounds.
  • Precisely two of the values occurred exactly twice, but these values were only written down once.
  • Each of the individual weights (in pounds) is a positive integer.
Derive the weights of the pumpkins and which two values occur twice.

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

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

DECLARE SUB test (x!, y!)
DIM SHARED good, sumct(81)
CLS
FOR a = 1 TO 14
  b = 27 - a
  c = 36 - a
  FOR f = c + 1 TO 81
    e = 81 - f
    d = 75 - f
    IF d > c AND e > d THEN
       FOR i = 1 TO 81: sumct(i) = 0: NEXT
       sumct(27) = 1: sumct(36) = 1: sumct(81) = 1: sumct(75) = 1
       good = 1
       test a, d
       test a, e
       test a, f
       test b, c
       test b, d
       test b, e
       test b, f
       test c, d
       test c, e
       test c, f
       test d, e
       IF good THEN
        PRINT a; b; c; d; e; f
        FOR i = 1 TO 81
          SELECT CASE i
           CASE 27, 36, 39, 45, 48, 51, 54, 57, 63, 66, 72, 75, 81
            PRINT i; sumct(i),
          END SELECT
        NEXT
        PRINT : PRINT
       END IF
    END IF

  NEXT f
NEXT a

SUB test (x, y)
  sum = x + y
  SELECT CASE sum
     CASE 27, 36, 39, 45, 48, 51, 54, 57, 63, 66, 72, 75, 81
       found = 1
       sumct(sum) = sumct(sum) + 1
     CASE ELSE
       found = 0
  END SELECT
  IF found = 0 THEN good = 0
END SUB

reports

 9  18  27  30  36  45
 27  1         36  1         39  1         45  2         48  1
 51  0         54  2         57  1         63  2         66  1
 72  1         75  1         81  1
 12  15  24  33  39  42
 27  1         36  1         39  1         45  1         48  1
 51  1         54  2         57  2         63  1         66  1
 72  1         75  1         81  1

The first set has no 51 as a sum, while 45, 54 and 63 are all repeated.

The second set fulfills the conditions:

12, 15, 24, 33, 39 and 42 pounds.

The repeated totals are 54 and 57.


  Posted by Charlie on 2014-01-22 11:38:11
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 (2)
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