#include<iostream>
using namespace std;
void Permutation (int *a,const int k,const int m)
{
if(k == m)
{
for(int i = 0;i<m;i++)
cout<<a[i]<<" ";
cout <<endl;
return;
}
for(int i = 0;i<2;i++)
{
a[k] = i;
Permutation(a,k+1,m);
}
}
void print(int n)
{
int *a = new int[n];
Permutation(a,0,n);
}
int main()
{
int n ;
cout<<"Input the length of team:";
cin>>n;
print(n);
return 0;
}
01全排列算法
最新推荐文章于 2022-01-29 22:56:13 发布