29 lines
521 B
C++
29 lines
521 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
int count(int step, int l, int r, int a[])
|
|
{
|
|
if (step == 0)
|
|
{
|
|
if (l + a[0] == r || r + a[0] == l)
|
|
{
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
return count(step - 1, l + a[step], r, a) + count(step - 1, l, r + a[step], a);
|
|
}
|
|
|
|
int main()
|
|
{
|
|
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
|
|
int n;
|
|
cin >> n;
|
|
int a[n];
|
|
for (int i = 0; i < n; i++)
|
|
{
|
|
cin >> a[i];
|
|
}
|
|
cout << count(n - 1, 0, 0, a) / 2;
|
|
} |