UVA12357 Ball Stacking

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=278&page=show_problem&problem=3779 [PDF](https://uva.onlinejudge.org/external/123/p12357.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12357/bb5aaa6df2367724f8bd2e23bb150788a112c559.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12357/3b02d1bdd8f5a21b0aa39f7466cf57dc5be1007c.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12357/0852ee2211d92afa341a4b7f0d613a0111a711a8.png)