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
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

const int P = 1000000007;

bool modupalo(long long i){
	return i % P % 2 == 0;
}

int main(){
	int n;
	cin >> n;
	vector<long long> nums(n);
	vector<long long> sum_to_n(n);
	for(int i= 0; i<n; i++) cin >> nums[i];
	for(int i = 0; i < n; i++){
		long long currentSum = 0;
		long long currentCount = 0;
		for(int j = i; j >= 0; j--){
			currentSum += nums[j];
			if(modupalo(currentSum)){
				currentCount += j == 0 ? 1L : sum_to_n[j - 1];
			}
		}
		sum_to_n[i] = currentCount % P;
	}
	cout << sum_to_n[n-1] << endl;
}