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
45
46
47
48
49
50
51
52
53
54
55
56
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    int p=1000000007;
    cin >> n;
    vector<int>we(n);
    for (int i=0;i<n;i++){
        cin >> we[i];
    }
    //vector<vector<int>>po(n);
    int suma=0;
    vector<int>moz(n+1);
    moz[0]=1;
    for (int i=0;i<n;i++){
        //po[i].push_back(we[i]);
        suma=we[i];
        //po[i][0]%=p;
        if(/*po[i][0]*/suma%2==0){
            moz[i+1]+=moz[i];
            moz[i+1]%=p;
        }
        
        for (int j=i-1;j>=0;j--){
            //po[i].push_back(po[i][po[i].size()-1]+we[j]);
            suma+=we[j];
            suma%=p;
            //po[i][po[i].size()-1]%=p;
            if(/*po[i][po[i].size()-1]*/suma%2==0){
                moz[i+1]+=moz[j];
                moz[i+1]%=p;
            }
        }
        //cout << "moz["<<i+1<<"]: " <<moz[i+1] << endl;
    }
    cout << moz[n] << endl;
    /*for (int i=0;i<n;i++){
        cout << "po["<<i<<"]: ";
        for (int j=0;j<po[i].size();j++){
            cout << po[i][j] << " ";
        }
        cout << endl;
    }*/
    //cout <<"moz:"<<moz[n]<<endl;
    /*for (int i=0;i<=n;i++){
        cout << "moz["<<i<<"]:"<<moz[i]<<endl;;
    }*/
    /*vector<int>moz(n+1);
    moz[0]=1;*/
    /*for (int i=1;i<=n;i++){
        if(po[i-1]%2==0){
            moz[i]=moz[i-1];
        }
    }*/
}