Subarray Sum

0

0 votes
Problem

Given an array of n positive integers, your task is to count the number of subarrays having sum x.

Input:

The first input line has two integers n and x: the size of the array and the target sum x.
The next line has n integers a1,a2,…,an: the contents of the array.

Output:

Print one integer: the required number of subarrays.

Constraints:

1≤n≤2⋅105

1≤x,ai≤109

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?