SUbset SUM

http://www.spoj.com/problems/SUBSUMS/
I wrote the below code for the above problem .. but i am getting runtime error and i don't know why ? Please help ....


#include<stdio.h>
#include<math.h>
int main()
{
long long n,a,b;
long long sum,size,powsize,N[34],count;
count=0;
scanf("%lld %lld %lld",&n,&a,&b);
powsize=(long long)pow(2,n);
size=0;
for(long long i=0;i<n;i++)
scanf("%lld",&N[i]);

for(long long i=0;i<powsize;i++)
{
sum=0;
for(long long j=0;j<size;j++)
{
if(i&((long long)1><<j))
sum+=N[j];
}
if(sum>=a&&sum<=b)
count++;
size++;
}
printf("%lld\n",count);
return 0;
}
Topic archived. No new replies allowed.