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
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int uc[n], b=1, il=0;
	vector<int> buc;
	
	for(int i=0; i<n; i++)
	cin>>uc[i];
	
	for(int j=0; j<n; j++)
	{
		buc.push_back(uc[j]);
		b=1;
		for(int k=0; k<n-j-1; k++)
		{
			buc.push_back(buc.back()+uc[j+b]);
			b++;
		}
	}
	
	for(int e=0; e<buc.size(); e++)
	{
		for(int f=e+1; f<buc.size(); f++)
		{
			for(int g=f+1; g<buc.size(); g++)
			{
				if(buc[e]+buc[f]+buc[g]==0)
				il++;
			}
		}
	}
	
	cout<<il;
	
	return 0;
}