There are 12 balls, including 1 ball weight and other 11 balls. The weight of 11 balls is the same. The condition is only a balance; if the balance can only be scales 3 times, find that the ball.
IF (abcd == 1234) {// First // Target in ABCD IF (ABC == ABC) {// ABC is a standard ball .... Second // Target D if (D> 1) {// The third bad ball is D, heavy;} else {bad ball is D, light;}} elseif (ABC> ABC) {// ABC is a standard ball .... second // Target in ABC In the middle, the bad ball is heavier IF (aa == bb) {// third ... bad ball is C, heavy;} elseif (aa> bb) {// third times ..... Bad ball is A, heavy;} else {// third times ... bad ball is B, heavy}} else {// ABC is a standard ball .... Second // Target in ABC In the middle, the bad ball is over //, the same episode, the third time ...}} elseif (abcd> 1234) {// First ..., ABCD is the standard // target in ABCD1234, take off 234 if (AABC == 1BCD) {// Second ... // Target in 234.. Light .. // Third ... Solution is the same as above ...} elseif (AABC <1BCD) {/ / Target in BCD ... Heavy ... // Third ... Solution is in the same ...} else {// Target A or 1 in ... 1 Light, a Ren}} else { // First .... ABCD <1234 // Target in ABCD1234, take the BCD IF (A234> 1ABC) {// ..... // Target at 234 ... Heavy ..} elseif A234 <1ABC) {// Targets in A or 1 ... a light .. Heavy ..} else {// Target in BCD ... light .. // Third ... solution. ..}}