UVA12642 Shuffling Cards

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=602&page=show_problem&problem=4390 [PDF](https://uva.onlinejudge.org/external/126/p12642.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12642/4baac78ca5e2e0c28218e5ec16d52a383c9270cc.png)

Input Format

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

Output Format

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