本题的输入格式和题目描述是一样的。
原题的输入格式为:
The first line contains two integers n and k (1≤n,k≤2000) — the number of people and the maximal capacity of the elevator.
The next line contains n integers: f1, f2,…, fn (2≤fi≤2000),where fi denotes the target floor of the i-th person.
The first line contains two integers $n$ and $k$ $\left(1\leq n, k \leq 2000\right)$ — the number of people and the maximal capacity of the elevator.
The next line contains $n$ integers: $f_1$, $f_2$,$…$, $f_n$ $\left(2\leq f_i\leq 2000 \right)$,where $f_i$ denotes the target floor of the i-th person.
顺便补一下翻译:
有 n 个人,每个人有一个要去的层数 fi。
有一个每次能容纳 k 人的电梯,电梯初始位于 1 层,电梯从 a 层到 b 层需要 ∣a−b∣ 单位的时间。
请求出将所有人运送到对应层数,然后让电梯返回第 1 层的最少时间。
有 $n$ 个人,每个人有一个要去的层数 $f_i$。
有一个每次能容纳 $k$ 人的电梯,电梯初始位于 $1$ 层,电梯从 $a$ 层到 $b$ 层需要 $|a-b|$ 单位的时间。
请求出将所有人运送到对应层数,然后让电梯返回第 $1$ 层的最少时间。