UVA906 Rational Neighbor

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=11&page=show_problem&problem=847 [PDF](https://uva.onlinejudge.org/external/9/p906.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA906/d7e23243f6e4bd021302e7a1344138f0f9b12f14.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA906/4397d42875ad0943b317ac753c1486b5f68b9f05.png)

Output Format

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