、、、
include[HTML_REMOVED]
using namespace std;
const int N = 1e5 + 5;
typedef long long LL;
int s[N];
int main()
{
int n;
cin >> n;
for(int i = 1; i <= n; i)
{
int x;
cin >> x;
s[i] = s[i - 1] + x;
}
if(s[n] % 3)
puts(“0”);
else
{
int cnt = 0;
LL res = 0;
for(int j = 1; j < n - 1; j)
{
if(s[j] == s[n] / 3) cnt++;
if(s[j + 1] == s[n] / 3 * 2) res += cnt;
}
cout << res;
}
return 0;
}
、、、