310959: CF1914B. Preparing for the Contest

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Preparing for the Contesttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Monocarp is practicing for a big contest. He plans to solve $n$ problems to make sure he's prepared. Each of these problems has a difficulty level: the first problem has a difficulty level of $1$, the second problem has a difficulty level of $2$, and so on, until the last ($n$-th) problem, which has a difficulty level of $n$.

Monocarp will choose some order in which he is going to solve all $n$ problems. Whenever he solves a problem which is more difficult than the last problem he solved, he gets excited because he feels like he's progressing. He doesn't get excited when he solves the first problem in his chosen order.

For example, if Monocarp solves the problems in the order $[3, \underline{5}, 4, 1, \underline{6}, 2]$, he gets excited twice (the corresponding problems are underlined).

Monocarp wants to get excited exactly $k$ times during his practicing session. Help him to choose the order in which he has to solve the problems!

Input

The first line contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases.

Each test case consists of one line containing two integers $n$ and $k$ ($2 \le n \le 50$; $0 \le k \le n - 1$).

Output

For each test case, print $n$ distinct integers from $1$ to $n$, denoting the order in which Monocarp should solve the problems. If there are multiple answers, print any of them.

It can be shown that under the constraints of the problem, the answer always exists.

ExampleInput
3
6 2
5 4
5 0
Output
3 5 4 1 6 2
1 2 3 4 5
5 4 3 2 1

Output

题目大意:
Monocarp正在为一场大型比赛做准备,他计划解决n个问题以确保做好准备。这些问题按照难度递增的方式编号,第一个问题的难度为1,第二个问题的难度为2,以此类推,直到第n个问题,其难度为n。Monocarp将选择一个顺序来解决所有n个问题。每当他解决一个比他上次解决的问题难度大的问题时,他会感到兴奋,因为他觉得自己在进步。当他解决所选顺序中的第一个问题时,他不会感到兴奋。Monocarp希望在练习期间兴奋恰好k次。帮助他选择解决问题的顺序!

输入数据格式:
第一行包含一个整数t(1≤t≤1000)——测试用例的数量。
每个测试用例包含一行,包含两个整数n和k(2≤n≤50;0≤k≤n-1)。

输出数据格式:
对于每个测试用例,打印n个从1到n的不同的整数,表示Monocarp应该解决问题的顺序。如果存在多个答案,则打印其中任何一个。
根据问题的约束,可以证明答案总是存在的。题目大意: Monocarp正在为一场大型比赛做准备,他计划解决n个问题以确保做好准备。这些问题按照难度递增的方式编号,第一个问题的难度为1,第二个问题的难度为2,以此类推,直到第n个问题,其难度为n。Monocarp将选择一个顺序来解决所有n个问题。每当他解决一个比他上次解决的问题难度大的问题时,他会感到兴奋,因为他觉得自己在进步。当他解决所选顺序中的第一个问题时,他不会感到兴奋。Monocarp希望在练习期间兴奋恰好k次。帮助他选择解决问题的顺序! 输入数据格式: 第一行包含一个整数t(1≤t≤1000)——测试用例的数量。 每个测试用例包含一行,包含两个整数n和k(2≤n≤50;0≤k≤n-1)。 输出数据格式: 对于每个测试用例,打印n个从1到n的不同的整数,表示Monocarp应该解决问题的顺序。如果存在多个答案,则打印其中任何一个。 根据问题的约束,可以证明答案总是存在的。

加入题单

上一题 下一题 算法标签: