BETA

#### Submissions: 348 Accuracy: 29.6%

Find all distinct subset (or subsequence) sums

Given a set of integers, find distinct sum that can be generated from the subsets of the given sets and print them in an increasing order. It is given that sum of array elements is small.

Input:

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains an integer N denoting the size of array A.

The second line of each test case contains N space separated integers denoting elements of the array A[ ].

Output:

Print all the distinct sum that can be generated from the subsets in increasing order for each testcase in a new line.

Constraints:

1<= T <=100

1<= N <=100

1<= A[ ] <=100

Example:

Input:

1

5

2 3 4 5 6

Output:

0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sujnesh Mishra

##### It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result: