数字的组合
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
问题描述
n 个互不相等的数中,选出 r 个数的组合,请问有哪些不同的选法,按照字典码的顺序,输出这些选出的数,每组数输出时要求按照从小到大的顺序输出。
输入
第 1 行输入两个整数 n(3≤n≤20)和 r(1≤r≤n); 第 2 行输入 n 个整数,数字之间用空格隔开,请注意:输入的n个整数不保证是有序的。
输出
输出若干行,每行有 r 个数,用空格隔开。
Samples
5 3
1 2 3 4 5
1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5
5 3
2 3 5 1 4
1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5
Limitation
1s, 1024KiB for each test case.
3.1
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 10
- Start at
- 2025-2-28 17:15
- End at
- 2025-3-21 13:15
- Duration
- 500 hour(s)
- Host
- Partic.
- 4