Задачі
Одноразові камені
include <bits/stdc++.h>
using namespace std;
define io iosbase::syncwith_stdio(0);cin.tie(0);
define int long long
signed main() { io
int n, k, a[100005];
cin >> n >> k;
n--;
for(int i=0; i<n; i++){
cin >> a[i];
}
int l=0, r=0, sm = 0, ans = INT_MAX;
bool ol = false;
while(r<n){
r++;
if(ol) l++;
sm += a[r-1];
if(r-l == k){
ans = min(ans, sm);
sm -= a[l];
ol = true;
}
}
cout << ans;
}