2020-12-24

//#pragma warning(disable:4996)
#include<iostream>
#define maxn 100
using namespace std;
int ans[maxn];
bool vis[maxn];
int n;
void dfs(int x)
{
	if (x > n)
	{
		for (int i = 1; i <= n; i++)
			cout << ans[i] << " ";
		cout << "\n";
		return;
	}
	else
	{
		for (int i = 1; i <= n; i++)
		{
			if (!vis[i])
			{
				vis[i] = 1;
				ans[x] = i;
				dfs(x + 1);
				vis[i] = 0;
			}
		}
	}
}
int main()
{
	cin >> n;
	dfs(1);
	return 0;
}
上一篇:从Hive1.0升级到Hive2.0(删除hive1.x中的元数据, 并不是数据迁移)


下一篇:qt元对象系统之 Q_OBJECT宏