#Lutece0086. Divide
Divide
Migrated from Lutece 86 Divide
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Alice and Bob has found a island of treasure in byteland! They find kinds of treasures on the island, and each kind of treasure has a certain number, and as in byteland, the value of each treasure will be a power of , such as
Now the only problem is how to divide treasures fairly, they need to divide the treasures into two parts, and the value of each part is the sum of all treasures' in this part, they want to make the difference between the value of two parts as small as possible, can you help them?
Input
First line of the input is a single integer (), indicating there are test cases.
For each test case, the first line contain one integer (), indicate the different kinds of treasures.
Then line followed, each line will have follow two integer () and (), indicate there are treasures, and the value of each one is .
Output
For each case, you should output a single line, first output Case #t:
, where indicating the case number between and , then a string with only 0
and 1
followed, indicate the minimum difference in binary representation, find more details in samples.
Samples
Resources
Sichuan State Programming Contest 2012