首页 > 其他 > 详细

uva10098 Generating Fast, Sorted Permutation

时间:2015-01-24 22:41:46      阅读:328      评论:0      收藏:0      [点我收藏+]

#include"iostream"
#include"stdio.h"
#include"string.h"
#include"algorithm"
#include"stdlib.h"
using namespace std;
char s[100];
int main()
{
int t;
cin>>t;
getchar();
while(t--)
{
scanf("%s",s);
sort(s,s+strlen(s));//所有可能情况,故要先按从小到大排序
do
{
cout<<s<<endl;
}while(next_permutation(s,s+strlen(s)));
cout<<endl;//每一个输出后都有空行,不是每两个输出之间
}
return 0;
}

uva10098 Generating Fast, Sorted Permutation

原文:http://www.cnblogs.com/acm-jing/p/4246625.html

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