Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- typedef long long lint;
- int main()
- {
- int n;
- lint a,b;cin>>n>>a>>b;
- int ar[40];
- for(int x=0;x<n;x++)
- cin>>ar[x];
- lint ans=0;
- for(lint x=1;x<(1LL<<n);x++)
- {lint sum=0;
- lint ll=x;
- for(int m=0;ll;ll>>=1,m++)
- {
- if(ll&1)
- sum+=ar[m];
- if(sum>b)break;
- }
- if(sum>=a&&sum<=b)ans++;
- }
- if(a<=0&&b>=0)ans++;
- cout<<ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement