标签:16px temp 入门 算法 clu art ace int end mic
#include<iostream>
#include<algorithm>
#include<ctime>
#define Swap(a,b) {int temp=a;a=b;b=temp;}
using namespace std;
int data[]={1,2,3,4,5,6,7,8,9,10,32,15,18,33};
int num = 0;
int Perm(int begin,int end)
{
int i;
if(begin==end)
{
num++;
}
else
{
for(i=begin;i<=end;++i)
{
Swap(data[begin],data[i]);
Perm(begin+1,end);
Swap(data[begin],data[i]);
}
}
}
int main()
{
clock_t start,end;
start = clock();
Perm(0,9);
end = clock();
cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
cout<<num<<endl;
return 0;
}
标签:16px temp 入门 算法 clu art ace int end mic
原文地址:https://www.cnblogs.com/chrysanthemum/p/11835181.html