mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1256.cpp
This commit is contained in:
parent
ec320f8da6
commit
6adc773c83
40
POJ/1256.cpp
Normal file
40
POJ/1256.cpp
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
using namespace std;
|
||||||
|
char buff[1024];
|
||||||
|
|
||||||
|
//vector<string> vec;
|
||||||
|
|
||||||
|
bool cmp(const char& a,const char& b)
|
||||||
|
{
|
||||||
|
char c=a>='a'?a-'a':a-'A';
|
||||||
|
char d=b>='a'?b-'a':b-'A';
|
||||||
|
if(c!=d) return c<d;
|
||||||
|
else return a<b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int t;
|
||||||
|
scanf("%d%*c",&t);
|
||||||
|
for(int i=0;i<t;i++)
|
||||||
|
{
|
||||||
|
gets(buff);
|
||||||
|
string str(buff);
|
||||||
|
sort(str.begin(),str.end(),cmp);
|
||||||
|
////What? You mean this is needn't?
|
||||||
|
//if(find(vec.begin(),vec.end(),str)!=vec.end()) continue;
|
||||||
|
//vec.push_back(str);
|
||||||
|
printf("%s\n",str.c_str());
|
||||||
|
while(next_permutation(str.begin(),str.end(),cmp))
|
||||||
|
{
|
||||||
|
printf("%s\n",str.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user