# |
Author |
Problem |
Lang |
Verdict |
Time |
Memory |
Sent |
Judged |
|
110904366 |
Practice:
itti_da |
363B
- 19
|
C++17 (GCC 7-32)
|
Wrong answer on test 17
|
124 ms
|
576 KB
|
2021-03-24 17:44:40 |
2021-03-24 17:44:40 |
|
#include<iostream>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int sum=0,start=0;
for(int i=0;i<k;i++){
sum+=a[i];
}
int st=0,end=k,n_sum;
while(end<n){
n_sum=sum-a[st]+a[end];
st++;
end++;
if(n_sum<sum){
sum=n_sum;
start=st;
}
}
cout<<start+1;
return 0;
}
Click to see test details