Problem B: 组合数的生成

Problem B: 组合数的生成

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 101  Solved: 18
[Submit] [Status] [Web Board] [Creator:]

Description

从 1、2、3、4、5、6 这 6 个数字中任取 4 个数的组合有1 2 3 4、1 2 3 5、1 2 3 6、1 2 4 5、1 2 4 6、1 2 5 6、1 3 4 5、1 3 4 6、1 3 5 6、1 4 5 6、2 3 4 5、2 3 4 6、2 3 5 6、2 4 5 6、3 4 5 6,共 15 种。若把它们看成 4 位数,发现是递增的。


The combinations of any 4 numbers from the 6 numbers 1, 2, 3, 4, 5, and 6 are 1 2 3 4, 1 2 3 5, 1 2 3 6, 1 2 4 5, 1 2 4 6, 1 2 5 6, 1 3 4 5, 1 3 4 6, 1 3 5 6, 1 4 5 6, 2 3 4 5, 2 3 4 6, 2 3 5 6, 2 4 5 6, 3 4 5 6, There are 15 kinds in total. If you regard them as 4 digit numbers, you will find that they are increasing in value.

Input

输入 n 和 r,1≤r≤n≤20


Input n and r, 1≤r≤n≤20


Output

按照以上顺序,输出从 n 个数字(1~n)中任取 r 个数的所有组合


According to the above sequence, output all combinations of r numbers from n numbers (1~n)


Sample Input Copy

3 2

Sample Output Copy

1 2
1 3
2 3