UVA13099 Tobby and the line game

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=866&page=show_problem&problem=4997 [PDF](https://uva.onlinejudge.org/external/130/p13099.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA13099/c8d7c3e914f419ee4180b3fde923af2b0473ee81.png)

Input Format

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

Output Format

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