UVA12500 Balance the Blocks

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=441&page=show_problem&problem=3944 [PDF](https://uva.onlinejudge.org/external/125/p12500.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12500/7c42ff45f6f07cf25e846c84052c50d24705bc8c.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12500/c934aca3b10e542fada5a905b324b6313bcf5f35.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12500/9390cc0dda39ab12bd4faf586948c9a2631a1939.png)