UVA10514 River Crossing

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=17&page=show_problem&problem=1455 [PDF](https://uva.onlinejudge.org/external/105/p10514.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10514/97cfe201cf3d77f9d53c8e9dfc87626c71c1c1d0.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10514/6419a64f71a8435b90301fd9ada97494a37e3d39.png)

Output Format

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