考点
题解
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #include <bits/stdc++.h>
using namespace std;
const int LEN = 1e4 + 10;
int arr[LEN], N, M;
void print() { for (int i = 0; i < N; ++i) cout << arr[i] << " "; cout << endl; }
int main() { cin >> N >> M; for (int i = 0; i < N; ++i) cin >> arr[i]; while (M-- && next_permutation(arr, arr + N)) ; print(); return 0; }
|
思路
题意其实就是给了一个序列,将这个序列全排列若干次后再输出
不会真有人尝试10000的阶乘吧!不会吧不会吧不会吧不会吧不会吧!!