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

Home > Logic > Weights and Scales
Nine Marbles (Posted on 2014-09-20) Difficulty: 3 of 5
Three friends Ade, Ben and Cade have 9 marbles in front of them. Their weights are as follows:
154, 16, 19, 101, 10, 17, 13, 46 and 22 grams.

Each of the three friends takes 3 marbles. Ade's bunch weighs precisely twice as much as Bill's bunch.

What is the total weight in Cade's bunch?

See The Solution Submitted by K Sengupta    
Rating: 4.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re: Computer Program Solution Comment 6 of 6 |
(In reply to Computer Program Solution by Larry)

In MATLAB:


marbles=[154, 16, 19, 101, 10, 17, 13, 46, 22];
 
for i=1:7
    a(1)=marbles(i);
    for j=i+1:8
        a(2)=marbles(j);
        for k=j+1:9
           a(3)=marbles(k); 
           m2=marbles;
           m2(k)=[];m2(j)=[];m2(i)=[];
           
for l=1:4
    b(1)=m2(l);
    for m=l+1:5
        b(2)=m2(m);
        for n=m+1:6
            b(3)=m2(n);

c=m2;
c(n)=[];
c(m)=[];
c(l)=[];
           
if sum(a)==2*sum(b)
    disp(a)
    disp(b)
    disp(c)
     disp(sum(c))
end
            
        end
    end
end
        end
    end
end

Result:

    16    46    22
    19    10    13
   154   101    17
   272

Edited on November 9, 2020, 10:47 am
  Posted by Charlie on 2020-11-09 10:45:38

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 (24)
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