ZOJ Problem Set - 1316
The International Space Station contains many centrifuges in its labs. Each centrifuge will have some number (C) of chambers each of which can contain 0, 1, or 2 specimens. You are to write a program which assigns all S specimens to the chambers such that no chamber contains more than 2 specimens and the following expression for IMBALANCE is minimized.
CMi is the Chamber Mass of chamber i and is computed by summing the masses
of the specimens assigned to chamber i.
The next C lines will contain the chamber number in column 1, a colon in column number 2, and then the masses of the specimens your program has assigned to that chamber starting in column 4. The masses in your output should be separated by exactly one blank.
Your program should then print ``IMBALANCE = X" on a line by itself where X is the computed imbalance of your specimen assignments printed to 5 digits of precision to the right of the decimal.
The final line of output for each set should be a blank line. (Follow the sample output format.)
Source: South Central USA 1996