小明有3颗红珊瑚,4颗白珊瑚,5颗黄玛瑙。
他想用它们串成一圈作为手链,送给女朋友。
现在小明想知道:如果考虑手链可以随意转动或翻转,一共可以有多少不同的组合样式呢?
请你提交该整数。不要填写任何多余的内容或说明性的文字。
代码如下:
#include<iostream>
#include<vector>
using namespace std;
vector<string> vec;
int main()
{
int total=0;
string str="aaabbbbccccc";
do
{
int flag=1;
for(int i=0;i<vec.size();i++)
{
if(vec[i].find(str)!=string::npos)
{
flag=0;
break;
}
}
if(flag)
{
total++;
string tmp=str+str;
vec.push_back(tmp);
reverse(tmp.begin(),tmp.end());
vec.push_back(tmp);
}
}
while(next_permutation(str.begin(),str.end()));
cout<<total<<endl;
return 0;
}