Have a look at this code ....
#include <iostream>
#include <cmath>
using namespace std ;
int main() {
int n ;
cin >> n;
int a[n] ;
for(int i=0;i<n;i++)
cin >> a[i] ;
for(int i=1;i<=pow(2,n);i++){
for(int j=0;j<n;j++){
if( i & (1 << j)) {
cout << "J::" << j <<" " ;
// cout << "lks" << ( i & (1 << j)) <<endl ;
cout << a[j] <<" ";
}
}
cout << "\n";
}
return 0 ;
}
On Mon, Nov 1, 2010 at 11:19 PM, RIDER <[email protected]> wrote:
> given an array how to find number of set which results to give a
> particular sum ( consider continues, noncontinue) both.
>
> example [5, 5, 10, 2, 3] should return 4 (5 + 10, 5 + 10, 5 + 5 + 2 +
> 3, 10 + 2 + 3
>
> can we do any logical thing to computer sum if range is known??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
Lalit Kishore Sharma
IIIT Allahabad (Amethi Capmus)
5th Sem
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.