solution.cpp 614 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
vector<string> v;
int main()
{
    int count = 0;
    string a = "xxxyyyyzzzzz";
    do
    {
        int i;
        for (i = 0; i < v.size(); i++)
        {
            if (v[i].find(a) != string::npos)
            {
                break;
            }
        }
        if (i != v.size())
            continue;
        string b = a + a;
        v.push_back(b);
        reverse(b.begin(), b.end());
        v.push_back(b);
        count++;
    } while (next_permutation(a.begin(), a.end()));
    cout << count;
}