close
195.Anagram
#include#include #include #include using namespace std; const string strTable = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"; int table[128]; main() { for (int i = 0; i > loop; while (loop--){ string in; cin >> in; vector v; for (string::iterator it = in.begin(); it != in.end(); ++it){ v.push_back(table[*it]); } sort(v.begin(), v.end()); do { for (vector ::iterator it = v.begin(); it != v.end(); ++it){ cout
#include#include #include #include #include #include #include #include #include struct Order{ bool operator () (const char & c1, const char & c2) const{ if(tolower(c1) != tolower(c2)){ return tolower(c1) > m; std::string line; std::getline(std::cin, line); while(m--){ bool history[1000]; char buffer[1000]; char sorted[1000]; Order o; std::getline(std::cin, line); if(line.size() > 500){ std::cout
作者:foxs91092
#include#include #define MAX 100 char str[MAX]; char nowstr[MAX]; int nstr[MAX]; bool used[MAX]={false}; int len=0; int permu(int); int main() { int N; scanf("%d", &N); gets(str); for(int i=0; i =65&&str[i]nstr[j+1]) { char temp=str[j]; str[j]=str[j+1]; str[j+1]=temp; int ntemp; ntemp=nstr[j]; nstr[j]=nstr[j+1]; nstr[j+1]=ntemp; sw=true; } //swap } //sort permu(0); } return 0; } int permu(int now_depth) { if(now_depth==len) { nowstr[len]='\0'; printf("%s\n", nowstr); return 0; } //permutation is over char last='\0'; for(int i=0; i
全站熱搜