Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- using namespace std;
- typedef long long ll;
- int main() {
- int n, k, s;
- cin >> n >> k >> s;
- int niza[n];
- for(int i = 0; i < n; i++) {
- cin >> niza[i];
- }
- ll sum = 0;
- for(int i = 0; i < k - 1; i++) {
- sum += niza[i];
- }
- int i = 0;
- for(int j = k - 1; j < n; j++) {
- sum += niza[j];
- cout << sum << " ";
- sum -= niza[i];
- i++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement