提交时间:2024-01-07 15:19:39
运行 ID: 230051
#include<bits/stdc++.h> using namespace std; int n; vector<long long> a; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; long long sum = 0; a.push_back(0); for(int i = 1;i <= n;i++) { int tmp; cin >> tmp; sum+= tmp; a.push_back(tmp); } int x,y; cin >> x >> y; long long sh = 0; long long ni = 0; for(int i = x;i < y;i++) { sh += a[i]; } ni = sum - sh; cout << min(sh,ni) << endl; return 0; }