Esempio n. 1
0
int main(){
	//long long set[] = {1,2,3};
    sum = 0;
    //printPowerSet(set, 3);
 	//printf("%lld",sum);
    

    int T;
	scanf("%d",&T);
	int tn = 1;	
	long long n;
	//set[0] = 0;
	while(tn <= T){
		sum = 0;
		long long index;
		scanf("%lld",&n);
		for(index = 1; index < n; index++){
			scanf("%lld",&set[index]);
		}

		qsort(set,n,sizeof(long long),cmpfunc);
		/*
		for(index = 0; index < n - 1; index++){
			computeAll(index + 1,index,n);
		}
		*/
		//computeAll(1,1,n);
		printPowerSet(n);
		printf("%lld\n",sum);
		tn++;
	}
    return 0;
}
void testPowerSetRecursive() {
    cout << endl;
    cout << "Test powerSetRecursive():" << endl;
    cout << "=========================" << endl;

    set<char> s;

    s.insert('a');
    s.insert('b');
    s.insert('c');
    s.insert('d');
    s.insert('e');

    cout << "s = ";
    printSet(s);

    set<set<char>> p = powerSetRecursive(s);
    cout << "powerSetRecursive(s) = " << p.size()
         << " subsets:" << endl;
    printPowerSet(p);
}
Esempio n. 3
0
/*Driver program to test printPowerSet*/
int main()
{
    char set[] = {'a', 'b','c', 'd'};
    printPowerSet(set, 4);
    return 0;
}
int main()
{
    char set[] = "1234";
    printPowerSet(set, 4); 
    return 0;
}