0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-30 19:36:27 +00:00
OI-codes/Luogu/problem/P1614/P1614.cpp
2021-01-02 15:30:52 +08:00

22 lines
439 B
C++

// https://www.luogu.com.cn/record/36322094
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, a[100005], minn=100000, t=0;
cin >> n >> m;
for(int i = 1 ; i <= n ; i++) {
cin >> a[i];
}
for(int i = 1 ; i <= n-m+1 ; i++) {
for(int j = 1 ; j <= m ; j++) {
t += a[i+j-1];
}
minn = min(t, minn);
t = 0;
}
cout << minn << endl;
return 0;
}