bylgd @ 2023-10-18 21:48:52
用全排列板子改一下输出得67pts
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#define int long long
using namespace std;
int n, k;
int a[100010];
bool vis[100010];
void dfs(int u)
{
if(u == k + 1)
{
for(int i = 1; i <= n; i ++ )
cout << a[i] << ' ';
puts("");
}
for(int i = 1; i <= n; i ++ )
{
if(!vis[i])
{
a[u] = i;
vis[i] = 1;
dfs(u + 1);
vis[i] = 0;
}
}
}
signed main()
{
cin >> n >> k;
dfs(1);
return 0;
}
by MornStar @ 2023-10-18 21:51:27
所以你想表达什么