Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int res = 0;
- int a[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
- do {
- bool ok = true;
- for (int i = 2; i < 9; i++)
- if (a[i] == a[i - 1] && a[i] == a[i - 2]) ok = false;
- if (ok) {
- res++;
- }
- } while (next_permutation(a, a + 9));
- cout << res * 6 * 6 * 6 << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement