UVA10971 Building Construction

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=21&page=show_problem&problem=1912 [PDF](https://uva.onlinejudge.org/external/109/p10971.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10971/fe6c10f9273a1b85a29d0e2848c351357e6cfeeb.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10971/75552a495808ca5e49de4f52d8756aff6b569a0a.png)