思路:维护一个前缀和就可以了,水题



#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
int a[maxn],sum[maxn];
int main()
{
	int n;
    scanf("%d",&n);
	for(int i = 1;i<=n;i++)
		scanf("%d",&a[i]),sum[i]=a[i]+sum[i-1];
	int ans = 0;
	for(int i = 1;i<=n-1;i++)
		if(sum[i]==sum[n]-sum[i])
			ans++;
	printf("%d\n",ans);
}






Description



Once Bob took a paper stripe of n


Input



The first input line contains integer n (1 ≤ n ≤ 105) — amount of squares in the stripe. The second line contains n


Output



Output the amount of ways to cut the stripe into two non-empty pieces so that the sum of numbers from one piece is equal to the sum of numbers from the other piece. Don't forget that it's allowed to cut the stripe along the squares' borders only.


Sample Input



Input



9 1 5 -6 7 9 -16 0 -2 2



Output



3



Input



3 1 1 1



Output



0



Input



2 0 0



Output



1





阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6