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

Home > Logic > Weights and Scales
From Russia with love (Posted on 2012-08-11) Difficulty: 4 of 5
Let n be a fixed integer.
Kostya has a black box, such that if you put in exactly 2n+1 coins of distinct weights, the box will expose the coin of median weight.
The teacher gave Kostya 4n+1 coins of distinct weights and told him which coin has the median weight.

Can Kostya check whether the teacher is right, using the box not more than n+2 times?

Source : Russian Euler contest 2012

Rem: Note that Kostya can't just put 4n+1 coins in the box.
The box accepts exactly 2n+1 coins.
Hint: start with n = 1. .

No Solution Yet Submitted by Ady TZIDON    
No Rating

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

First let M be the median chosen by the teacher.  Choose another 2n coins to go with M. We will call this collection of coins the "blue bag" (Leaving behind 2n coins in a "red" bag)

Test if M is the median of this set of 2n+1 coins in the blue bag. 

If it isn't, swap the actual median of this blue bag of 2n+1 coins with a coin from the red bag.

Keep repeating this process up to the nth use of the box.

If M has never been the median of the blue box for these tests, then M is not the median.

Otherwise, M has been the median of a set of 2n+1 coins, and we still have at least one more test with the box at least.  Now we take M from the blue bag and put it with the red bag.  We then put the red bag of 2n+1 coins to the test.  If M is also the median of the red bag, then M is truely the median of the whole set.  If not, then M is not the median of the set.

  Posted by Chris, PhD on 2012-08-11 11:44:50
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information