나의정답.
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(int argc, char** argv) {
//freopen("input.txt", "rt", stdin);
int day, sequence, i;
scanf("%d %d", &day, &sequence);
int* temper= new int[day];
int max;
int comp = 0;
for (i = 0; i < day; i++) {
scanf("%d", &temper[i]);
}
for (i = 0; i < sequence; i++) {
comp += temper[i];
}
max = comp;
for (i = 0; i < day - sequence; i++) {
comp -= temper[i];
comp += temper[i + sequence];
if (comp > max)
max = comp;
}
printf("%d", max);
delete[] temper;
}