| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
郁闷中。。哪位大牛帮忙查查错啊,不甚感激。。。。#include <stdio.h>
#include <algorithm>
#include <memory.h>
using namespace std;
char s[14];
int value(char ch)
{
if (ch>='a') return 2*(ch-'a')+1;
return 2*(ch-'A');
}
bool cmp(const char x,const char y)
{
return value(x)<=value(y);
}
void read()
{
int t;
scanf("%d",&t);
while (t--)
{
memset(s,0,sizeof(s));
scanf("%s",s);
sort(s,s+int(strlen(s)),cmp);
do
{
printf("%s\n",s);
}while (next_permutation(s,s+int(strlen(s))));
}
}
int main()
{
read();
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator