0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-20 17:25:24 +00:00
OI-codes/Luogu/P1614/P1614.cpp

22 lines
448 B
C++
Raw Normal View History

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