Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
230036 2224梁翁思译 *小美走公路 C++ 解答错误 40 4 MS 1200 KB 455 2024-01-07 15:09:17

Tests(2/5):


#include<bits/stdc++.h> using namespace std; int n; vector<int> a; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; int sum = 0; for(int i = 0;i < n;i++) { int tmp; cin >> tmp; sum+=tmp; a.push_back(tmp); } int x,y; cin >> x >> y; int sh = 0; int ni = 0; x--; y--; for(int i = x;i < y;i++) { sh += a[i]; } ni = sum - sh; cout << min(sh,ni) << endl; return 0; }


测评信息: