提交时间:2024-09-23 07:04:12
运行 ID: 51640
#include<bits/stdc++.h> using namespace std; int main() { int m, n, sum, a; cin >> m >> n; sum = 0; if(m % 2 == 1){ for(int i = m;i <= n-1+n%2;i+=2){ cin >> a; sum += a; } }else{ for(int i = m+1;i <= n-1+n%2;i+=2){ cin >> a; sum += a; } }cout << sum; return 0; }