UVA12726 One Friend at a Time

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=823&page=show_problem&problem=4578 [PDF](https://uva.onlinejudge.org/external/127/p12726.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12726/f57f09d4a0d8ed2fb61b17a963f1aa877758bd9a.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12726/1d69c07857db3e32403631c2401d0b9661c57def.png)