#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
//排列-递归
//从k到m子序列排列
void perm(vector<int> & v,int k,int m)
{
if (k==m)
{
for (int i = 0; i <= m; i++)
{
cout << v[i] << " ";
}
cout << endl;
}
else
{
for (int i = k; i <= m; i++)
{
swap(v[k], v[i]);
perm(v,k+1, m);
swap(v[k], v[i]);
}
}
}
int main()
{
vector<int> v = { 1,2,3 };
perm(v, 0, 2);//全排列
cout << "hello world" << endl;
return 0;
}