greenFox,
The question was a restatement of the riddle itself and I probably did a poor job of capturing it. Let me be a little more verbose. Each time you use the balance, you are going to be comparing 2 groups (left and right) which may or may not represent the total number of balls (12). That's the part about
12 balls in groups of 2. You can only use the balance 3 times.
The problem as I see it can be attacked at least 2 ways. The first is just to exhaustively calculate all possible groupings which should result in balanced pairs over 3 tries and sift through the aftermath attempting to pick a set that can answer the riddle. The second is to assess what information is gained after each weighing and determine which ways might lead to a correct solution (which will require backtracking).
Personally, I have no idea how to go about writing this code and am not even sure if the approaches I described are the right ones to use. It was keeping me awake the other night so I figured if it got under my skin my fellow monks would like it too.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.