[Explanations] Binary

Subject to the effect 

  There are three integers $ A $, $ B $, $ C $, with the following $ N _ {(2)} $ $ N $ represents a binary (no leading $ 0 $).

  Provided $ A _ {(2)} $, $ B _ {(2)} $, $ C _ {(2)} $ maximum length of $ L $ ($ L \ leqslant 30 $), you need to construct three positive integers $ X $, $ Y $, $ Z $, satisfying the following conditions:

  (1) $ X _ {(2)} $, $ Y _ {(2)} $, $ Z _ {(2)} $ length does not exceed $ L $.

  (2) $ A _ {(2)} $ and $ X _ {(2)} the same number of $ $ $ 1.

  (3) $ B _ {(2)} $ and $ Y _ {(2)} the same number of $ $ $ 1.

  (4) $ C _ {(2)} $ and $ Z _ {(2)} $ $ in the same number of $ 1.

  (5) $X+Y=Z.$。

  Give you $ A $, $ B $, $ C $, you need to find the minimum to meet the conditions of the $ Z $. If the condition of the Z $ $ does not exist, then the output $ $ -1.

 

answer

  

Guess you like

Origin www.cnblogs.com/kcn999/p/11272676.html