您的位置:首页 > 其它

poj 1256

2015-06-18 16:07 295 查看
需要自定义比较函数,否则AaBbc会出错

#include<iostream>
#include<string.h>
#include<math.h>
#include<fstream>
#include<algorithm>
#include<stdio.h>
#include<queue>
#include<vector>
#define MAXSIZE 100
using namespace std;
const int MAXN = 1001;
int n = 0;
char s[14];

bool comp(char a, char b)
{
if (tolower(a) == tolower(b))
{
return a < b;
}else
{
return tolower(a) < tolower(b);
}
}
int main()
{
freopen("data_1256.txt","r",stdin);
while(scanf("%d", &n) != EOF)
{
for (int i = 0; i < n; i++)
{
scanf("%s", s);
sort (s, s + strlen(s), comp);
do
{
printf("%s\n", s);
}while(next_permutation(s, s + strlen(s), comp));
}
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: