Untitled
unknown
pascal
3 years ago
317 B
77
Indexable
const Max_PrefixSum=200000000; var n,k,x,t,ans,i,a:longint; b:array[-Max_PrefixSum..Max_PrefixSum] of longint; begin readln(n,k); b[0]:=1; for i:=1 to n do begin read(x); t:=t+x; ans:=ans+b[t-k]; inc(b[t]); end; write(ans); readln end.
Editor is loading...