#include<bits/stdc++.h>
int n, a[100001], s[100001], sum, minn = INT_MAX;
int main() {
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
s[i] = s[i - 1] + a[i];
sum += a[i];
}
for (int i = 1; i <= n - 1; i ++)
minn = min(minn, abs(sum - s[i] - s[i]));
cout << minn;
return 0;
}
评论区