67 (不是用DFS做的)
查看原帖
67 (不是用DFS做的)
1058749
King_and_Grey楼主2024/6/2 07:54
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n,m,a[100000];

void Prn(){
	for(int i = 1;i <= m;i++)
		cout << a[i] << " ";
	cout << endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		a[i] = i;
	}	
	do{
		Prn();
	}while(next_permutation(a + 1, a + n + 1));
	return 0;
}

错在哪?

2024/6/2 07:54
加载中...