View difference between Paste ID: 8nK4BNm3 and p6pzQtnk
SHOW: | | - or go back to the newest paste.
1
#include <bits/stdc++.h>
2
using namespace std;
3
const int mxn = 2e5;
4
									//#define Kin
5
6
int main()
7
{
8
	ios_base::sync_with_stdio(0);
9
	cin.tie(0);
10
11
#ifdef Kin
12
	(void)!freopen("input.txt", "r", stdin);
13
	(void)!freopen("output.txt", "w", stdout);
14
#endif
15
16-
	int t;
16+
		long long n, k;
17-
	cin >> t;
17+
18-
	while (t--)
18+
19-
	{
19+
20-
		long long n, x;
20+
21
		while (n--)
22
		{
23
			long long a;
24
			cin >> a;
25
			sum += a;
26
			count += mp[sum - x];
27
			mp[sum]++;
28
		}
29
		cout << count << '\n';
30
	return 0;
31
}