by heart

This is not really hard (by heart too). Just follow logic and use all information you have.
Number the balls, b1,b2,...,b13
(1) balance (b1,b2,b3,b4) vs (b5,b6,b7,b8)
IF( (1) is balanced) then ----IF 1
(2) balance (b9,b10) vs (b11,b1)
If((2) balanced) then (go to be either b12 or b 13)
(3) balance (b1) vs (b12) then
if((3) balanced) then
the ball is b13
else
the ball if b12
endif
else ((2) is not balanced) (go to be one of b9,b10,b11, suppose left is heavier
in step (2).)
(3.a) balance (b9) vs (b10)
if( (3.a) balanced) then
ball is b11
else
Now we are sure the ball is heavier.
The heavier side is the ball, either b9 or b10.
endif
endif
ELSE( (1) is not balanced) ----ELSE 1
put b6,b7,b8 aside (and remember which side was heavier in step (1),
assume it was left)
(2.a) balance (b1,b2,b5) vs (b3,b9,b10)
if( (2.a) is balanced) then (b6 or b7 or b8 and the ball is lighter)
(3.b) balance b6 vs b7
if( (3.b) is balanced) then
b8 is the ball
else
the ball is the lighter one either b6 or b7
endif
else ( (2.a) is no balanced
Does 2.a changed original direction of unbalance?
if(yes) the ball get to be either b3 or b5
(3.c) balance b1 vs b3
if( (3.c) balanced) then
the ball is b5
else
the ball is b3
endif
else (No. it does not changed original direction of unbalance)
In this case only b1 or b2 can be the ball.
(3.d) balance b1 vs b2
The heavier one is the ball.
endif
ENDIF ---- IF 1

所有跟帖: 

From If(2), b12&b13, you didn't tell the ball is ligher or heav -twfx- 給 twfx 發送悄悄話 (28 bytes) () 05/04/2010 postreply 15:53:01

Be careful. -jinjing- 給 jinjing 發送悄悄話 (82 bytes) () 05/04/2010 postreply 16:07:56

請您先登陸,再發跟帖!