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

Home > Logic
Bullseye II (Posted on 2014-02-25) Difficulty: 3 of 5
  1. Riley, Ricardo and Reuben each fired six shots, and each got 71 points.
  2. Riley's first two shots scored 22 points and Ricardo’s first shot scored only 3 points.
  3. The scores for the 18 shots were as follows:
                  50-----1
                  25-----2
                  20-----3
                  10-----3
                  05-----2
                  03-----2
                  02-----2
                  01-----3
Who scored the Bullseye?

No Solution Yet Submitted by K Sengupta    
No Rating

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

All six sets of three possible scores of 71 in six shots are actually the same--just the six permutations of the three sets:

 50  10  5  3  2  1
 25  20  20  3  2  1
 25  20  10  10  5  1

 50  10  5  3  2  1
 25  20  10  10  5  1
 25  20  20  3  2  1

 25  20  20  3  2  1
 50  10  5  3  2  1
 25  20  10  10  5  1

 25  20  20  3  2  1
 25  20  10  10  5  1
 50  10  5  3  2  1

 25  20  10  10  5  1
 50  10  5  3  2  1
 25  20  20  3  2  1

 25  20  10  10  5  1
 25  20  20  3  2  1
 50  10  5  3  2  1

Only the  25  20  20  3  2  1 is capable of having 22 in two shots, and the only remaining one with a 3 is  50  10  5  3  2  1, who must be Ricardo, who thus has the 50.

DECLARE SUB addOn (wh!)
DATA 50,1
DATA 25,2
DATA 20,3
DATA 10,3
DATA 5,2
DATA 3,2
DATA 2,2
DATA 1 ,3

DIM SHARED denom(8, 2)
DIM SHARED used(8), h(18), tot, ct

FOR d = 1 TO 8
 READ denom(d, 1), denom(d, 2)
NEXT

CLS

addOn 1

PRINT ct

SUB addOn (wh)
  IF wh = 1 OR wh = 7 THEN st = 1: ELSE st = h(wh - 1)
  IF wh <= 6 THEN goal = 71:  ELSE goal = 142
  FOR i = st TO 8
   IF used(i) < denom(i, 2) THEN
    IF denom(i, 1) < goal - tot AND wh <> 6 AND wh <> 12 OR denom(i, 1) = goal - tot AND (wh = 6 OR wh = 12) THEN
   
      h(wh) = i
      used(i) = used(i) + 1
      tot = tot + denom(i, 1)
    
      IF wh = 12 THEN
        FOR j = 1 TO 6: PRINT denom(h(j), 1); : NEXT: PRINT
        FOR j = 7 TO 12: PRINT denom(h(j), 1); : NEXT: PRINT
        FOR j = 1 TO 8
          FOR k = 1 TO denom(j, 2) - used(j)
            PRINT denom(j, 1);
          NEXT
        NEXT
        PRINT : PRINT
        ct = ct + 1
      ELSE
        addOn wh + 1
      END IF
   
      tot = tot - denom(i, 1)
      used(i) = used(i) - 1

    END IF
   END IF
  NEXT
END SUB

 


  Posted by Charlie on 2014-02-25 15:56:42
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