Advertisement
Korotkodul

ege_N8_TOO_LONG

Mar 30th, 2023 (edited)
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <cmath>
  5. using namespace std;
  6.  
  7. bool f(vector <int> a) {
  8.     vector <int> cnt = {0, 0};
  9.     for (int i: a) {
  10.         cnt[i % 2]++;
  11.     }
  12.     if (cnt[1] != 3) {
  13.         return 0;
  14.     }
  15.     for (int i = 0; i < 10; ++i) {
  16.         if (a[i] % 2 == 1 && a[i + 1] % 2 == 1) {
  17.             return 0;
  18.         }
  19.     }
  20.     return 1;
  21. }
  22.  
  23. int main()
  24. {
  25.     int ans = 0;
  26.     vector <int> v = {0, 1, 2, 3, 4, 5, 6, 7};
  27.     for (int a0: v) {
  28.         for (int a1: v) {
  29.             for (int a2: v) {
  30.                 for (int a3: v) {
  31.                     for (int a4: v) {
  32.                         for (int a5: v) {
  33.                             for (int a6: v) {
  34.                                 for (int a7: v) {
  35.                                     for (int a8: v) {
  36.                                         for (int a9: v) {
  37.                                             for (int a10: v) {
  38.                                                 if (a10 == 0) continue;
  39.                                                 vector <int> a = {a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10};
  40.                                                 if (f(a)) {
  41.                                                     ans++;
  42.                                                 }
  43.                                             }
  44.                                         }
  45.                                     }
  46.  
  47.                                 }
  48.                             }
  49.                         }
  50.                     }
  51.                 }
  52.             }
  53.         }
  54.     }
  55.     cout << "ans = " << ans << "\n";
  56. }
  57. /*
  58.  
  59.  
  60. */
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement