Advertisement
qwerty787788

Untitled

Sep 21st, 2014
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. int res = 0;
  2. int a[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
  3. do {
  4.     bool ok = true;
  5.     for (int i = 2; i < 9; i++)
  6.         if (a[i] == a[i - 1] && a[i] == a[i - 2]) ok = false;
  7.     if (ok) {
  8.         res++;
  9.     }
  10. } while (next_permutation(a, a + 9));
  11. cout << res * 6 * 6 * 6 << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement