#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, maxa = 0; cin >> n; vector<int> a(n); for (auto& num : a){ cin >> num; maxa = max(maxa, num); } if (maxa > 100){ cout << 2137 << "\n"; return 0; } int cnt = 0, act = 0; for (int i = 0; i < n; i++){ act += a[i]; if (act % 2 == 0){ cnt++; act = 0; } } if (act != 0){ cout << 0 << "\n"; return 0; } long long ans = 1; for (int i = 1; i < cnt; i++) ans = (ans*2) % MOD; cout << ans << "\n"; return 0; }
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, maxa = 0; cin >> n; vector<int> a(n); for (auto& num : a){ cin >> num; maxa = max(maxa, num); } if (maxa > 100){ cout << 2137 << "\n"; return 0; } int cnt = 0, act = 0; for (int i = 0; i < n; i++){ act += a[i]; if (act % 2 == 0){ cnt++; act = 0; } } if (act != 0){ cout << 0 << "\n"; return 0; } long long ans = 1; for (int i = 1; i < cnt; i++) ans = (ans*2) % MOD; cout << ans << "\n"; return 0; } |