2
$\begingroup$

This question already has an answer here:

You are blindfolded (and you can’t see a thing). There are $100$ coins lying on a table. Of these coins, $80$ are tails-up and $20$ are heads-up. You need to divide them into two groups of $x$ and $y$ each (with $x+y = 100$). You can pick any coin and flip it (if it is tails, it will become head and if it is head, it will become tail), but you can't see so you don't know which coin you are flipping. In the end, both groups should contain equal number of heads.

$\endgroup$

marked as duplicate by frodoskywalker, f'', Lopsy, mmking, Deusovi Jul 25 '15 at 14:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com Jul 25 '15 at 9:24

This question came from our site for professional and enthusiast programmers.

2
$\begingroup$

The trick is simple: When dividing, make the first pile as big as the number of heads-up coins, i.e. 20. That first pile now contains an unkown number of heads-up coins, call that number n. The second pile of 80 coins contains the remaining 20-n heads-up coins. Now flip all coins in the first pile and both piles will contain exactly 20-n heads-up coins, regardless of the value of n.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.