UVA12536 Optimal Spaceway

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=441&page=show_problem&problem=3981 [PDF](https://uva.onlinejudge.org/external/125/p12536.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12536/0ebeaf90e378a11e08d18ca4cb0d6be9832edf44.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12536/8c8ab72070ef9dece367d80721ae4d84edd786bb.png)