UVA12000 K-Transformed Permutations

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=242&page=show_problem&problem=3151 [PDF](https://uva.onlinejudge.org/external/120/p12000.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12000/3aff2e0968afac53cc42c8d69d6fb83696281b99.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12000/498ab09c6cc38326db9f9561fef8f9e31f499fab.png)