You are given four balloons: red, blue, green and yellow. Some (or all) of the balloons might be counterfeit.
A detector box can display the quantity of counterfeit balloons inside the box.
Your task is to detect all the genuine balloons using the detector box not over three times.
How would you do it?
Source: Russian Kvantik.
Letter the balloons A,B,C,D
1st detection: A,B,C
2nd detection: A,B,D
3rd detection: A,C,D
The ordered triple of numbers of counterfeit balloons can uniquely identify which balloons are counterfeit.
Proof:
The one-one correspondence between Counterfeits and Triple is
none 0,0,0
A 1,1,1
B 1,1,0
C 1,0,1
D 0,1,1
AB 2,2,1
AC 2,1,2
AD 1,2,2
BC 2,1,1
BD 1,2,1
CD 1,1,2
ABC 3,2,2
ABD 2,3,2
ACD 2,2,3
BCD 2,2,2
ABCD 3,3,3
So for example if the first detection says 2 counterfeits and the second and third each say 1. We know that only B and C are counterfeits.
I don't know if this solution - test 3 every time - is the only one.
Edited to fix an error in the example.
Edited on January 13, 2016, 7:22 am
|
Posted by Jer
on 2016-01-12 10:45:41 |