第三题 滑动窗口解法 long long minimum(vector<int>& a) { // write code here int left = 0; int sum = 0, sum1 = 0;//sum1窗口内元素和 for (int i : a) { sum += i; } int avg = sum / 2; int ans = INT_MAX; for (int right = 0;right < a.size();right++) { sum1 += a[right]; ans = min(abs(sum - sum1 - sum1), ans); while (sum1>avg) { sum1 -= a[left]; left++; ans = min(abs(sum - sum1 - sum1), ans); } } return ans; }