笔记见平板
#include<iostream> #include<algorithm> #include<cmath> #include<vector> using namespace std; vector<string>v; vector<string>::iterator it; int main() { string str="aaabbbbccccc"; int cnt=0; do{ for(it=v.begin();it!=v.end();it++) { if((*it).find(str)!=string::npos) { break; } } if(it!=v.end()) continue; string str2=str+str; v.push_back(str2); reverse(str2.begin(),str2.end()); v.push_back(str2); cnt++; }while(next_permutation(str.begin(),str.end())); cout<<cnt<<endl; return 0; }
原文:https://www.cnblogs.com/h694879357/p/12636347.html