[信息与未来 2016] 洗牌

Luogu
IDLGB4138
Time1000ms
Memory512MB
DifficultyP2
模拟2016江苏信息与未来
小明把 $n$($n$ 为偶数)张牌按编号顺序 $1,2,3,\dots ,n$ 排成一堆,然后开始洗牌。一次洗牌的过程如下: 1. 对于一堆编号为 $a_1,a_2,\dots,a_n$,首先将牌分成均匀的两堆:$a_1,a_2,\dots,a_m$ 和 $a_{m+1},a_{m+2},\dots,a_n$(其中 $m=\frac{n}{2}$)。 1. 然后按顺序交叉插入:$a_1,a_{m+1},a_2,a_ {m+2},\dots,a_m,a_n$。 洗牌过程总共重复了 $k$ 次,请你编程帮助小明模拟洗牌的过程。 例如 $n=6$,初始时,牌堆中牌的编号为 $1,2,3,4,5,6$。 首次洗牌时,会将牌分成 $1,2,3$ 和 $4,5,6$ 两堆,交叉插入后的结果为 $1,4,2,5,3,6$。 再次洗牌,会将牌分成 $1,4,2$ 和 $5,3,6$ 两堆,交叉插入后,得到 $1,5,4,3,2,6$。 ## Input 一行,正整数 $n,k,i$,分别代表牌的数量、洗牌的次数、和牌的位置。 ## Output $n$ 张牌洗牌 $k$ 次后,牌堆中第 $i$ 张牌的编号。 [samples] ## Note 对于 $100\%$ 的数据,$1\leq n,k\leq 1000,1\leq i\leq n$。 保证 $n$ 是偶数。 >本题原始满分为 $20\text{pts}$。
Samples
Input #1
6 2 5
Output #1
2
Input #2
400 300 200
Output #2
368
API Response (JSON)
{
  "problem": {
    "name": "[信息与未来 2016] 洗牌",
    "description": {
      "content": "小明把 $n$($n$ 为偶数)张牌按编号顺序 $1,2,3,\\dots ,n$ 排成一堆,然后开始洗牌。一次洗牌的过程如下: 1. 对于一堆编号为 $a_1,a_2,\\dots,a_n$,首先将牌分成均匀的两堆:$a_1,a_2,\\dots,a_m$ 和 $a_{m+1},a_{m+2},\\dots,a_n$(其中 $m=\\frac{n}{2}$)。 1. 然后按顺序交叉插入:$a_1,a_",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P2"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4138"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "小明把 $n$($n$ 为偶数)张牌按编号顺序 $1,2,3,\\dots ,n$ 排成一堆,然后开始洗牌。一次洗牌的过程如下:\n\n1. 对于一堆编号为 $a_1,a_2,\\dots,a_n$,首先将牌分成均匀的两堆:$a_1,a_2,\\dots,a_m$ 和 $a_{m+1},a_{m+2},\\dots,a_n$(其中 $m=\\frac{n}{2}$)。\n\n1. 然后按顺序交叉插入:$a_1,a_...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments