Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- bool f(vector <int> a) {
- vector <int> cnt = {0, 0};
- for (int i: a) {
- cnt[i % 2]++;
- }
- if (cnt[1] != 3) {
- return 0;
- }
- for (int i = 0; i < 10; ++i) {
- if (a[i] % 2 == 1 && a[i + 1] % 2 == 1) {
- return 0;
- }
- }
- return 1;
- }
- int main()
- {
- int ans = 0;
- vector <int> v = {0, 1, 2, 3, 4, 5, 6, 7};
- for (int a0: v) {
- for (int a1: v) {
- for (int a2: v) {
- for (int a3: v) {
- for (int a4: v) {
- for (int a5: v) {
- for (int a6: v) {
- for (int a7: v) {
- for (int a8: v) {
- for (int a9: v) {
- for (int a10: v) {
- if (a10 == 0) continue;
- vector <int> a = {a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10};
- if (f(a)) {
- ans++;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- cout << "ans = " << ans << "\n";
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement