UVA11421 Arranging Cards

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=26&page=show_problem&problem=2416 [PDF](https://uva.onlinejudge.org/external/114/p11421.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11421/d87752966610947b9dd57731f7b6565ee7f91453.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11421/951241bba85334b3e0b3ca3b9c50741342ffbb6b.png)