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
#include <iostream>
using namespace std;

int n;
long long p = 1000000007;
long long a[300007];
long long res[300007];

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

  cin >> n;
  for (int i=0; i<n; i++)
    cin >> a[i + 1];

  res[0] = 1;
  for (int i=1; i< n+1; i++) {
    long long sum=0;
    res[i] = 0;
    for (int j=i; j>0; j--) {
      sum += a[j];
      sum = sum % p;
      if (sum % 2 == 0) {
        res[i] += res[j-1];
        res[i] = res[i] % p;
      }
    }
  }

  cout << res[n];

  return 0;
}