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
#include <bits/stdc++.h>
using namespace std;
const int p = 1000000007;

int main()
{
    ios::sync_with_stdio(0);

    int n; cin >> n;
    vector<long long> a(n), sol(n);
    for(int i=0; i<n; ++i) cin >> a[i];

    if(a[0]%2==0) sol[0] = 1;

    for(int i=1; i<n; ++i)
    {
        long long s = 0;
        int j=i;
        while(j>0)
        {
            s = (s + a[j])%p;
            --j;
            if(s%2==0)
                sol[i] += sol[j];
        }
        s = (s + a[0])%p;
        if(s%2==0)
            sol[i] = (sol[i] + 1)%p;
    }
    cout << sol[n-1] << endl;
}