首页 > 其他 > 详细

现成函数的全排列

时间:2016-04-30 19:28:25      阅读:292      评论:0      收藏:0      [点我收藏+]

#include <iostream>
#include <algorithm> /// next_permutation, sort里卖弄包括两个函数,桉顺序获得下一个要排列的数,也可以自己写一个泪时的函数。。
using namespace std;
int main () {
char myints[1005];
int n,i;while(cin>>myints)
{n=strlen(myints);
sort (myints,myints+n);

do {
for(i=0;i<n;i++)
cout<<myints[i];cout<<endl;
} while ( next_permutation(myints,myints+n) ); ///获取下一个较大字典序排列
}
return 0;
}

现成函数的全排列

原文:http://www.cnblogs.com/ddddacmer/p/5449097.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!