hiho week 212 register

Ended

Participants:168

Verdict:Accepted
Score:100 / 100
Submitted:2018-07-26 20:59:30

Lang:G++

Edit
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 <vector>
#include <iostream>
#include <numeric>
using namespace std;
int main()
{
    int N, target;
    cin >> N >> target;
    vector<int> vec;
    vec.reserve(N);
    int ct;
    for (int i = 0; i < N;i ++)
    {
        cin >> ct;
        vec.push_back(ct);
    }
    int sum = accumulate(vec.begin(), vec.end(), 0);
    if ( (sum + target) & 1)
    {
        cout << 0 << endl;
        return 0;
    }
    if (sum < target)
    {
        cout << 0 << endl;
        return 0;
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX