Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define ll long long
- #define ld long double
- #define FOR(i, a, b) for(ll i=(a); i<=(b); i++)
- #define FORn(i, n) for(ll i=1; i<=(n); i++)
- using namespace std;
- int n, k, a[100005], res;
- int main(){
- // freopen("PSEQ.inp", "r", stdin);
- // freopen("PSEQ.out", "w", stdout);
- // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- cin>>n>>k;
- FORn(i, n) cin>>a[i];
- FORn(i, n){
- int s=0;
- FOR(j, i, n){
- s+=a[j];
- if(s==k) res++;
- }
- }
- cout<<res;
- }
Advertisement
Add Comment
Please, Sign In to add comment