MAIN72  Subset sum
You are given an array of N integers. Now you want to find the sum of all those integers which can be expressed as the sum of at least one subset of the given array.
Input
First line contains T the number of test case. then T test cases follow, first line of each test case contains N (1 <= N <= 100) the number of integers, next line contains N integers, each of them is between 0 and 1000 (inclusive).
Output
For each test case print the answer in a new line.
Example
Input: 2 2 0 1 3 2 3 2 Output: 1 21
hide comments
esshuvo:
20170903 22:28:05
Problem is ambiguous!You have to caculate total sum of each subset whose sum is distinct :) 

code_aim:
20170704 17:15:19
0.01s 

coolio_1:
20170624 08:17:50
Direct application of subset sum using dp concept!!


heisenberg0820:
20170622 20:07:18
Just DP...No need for unordered set whatsoever :) 

aman_9899:
20170621 11:02:41
dp + unordered set ...!!!


shahzada:
20170306 15:27:52
Nice dp. 

madhavgaba:
20161229 18:00:39
printfscanf AC 0.01


aegon_c:
20161206 08:21:39
tighter constraints.. so use InputReader in case of java..


shubh809:
20161021 19:41:39
whop one more dp. 

Autorun:
20161005 17:23:48
TLE with python 3, even with some optimizations in I/O.

Added by:  Mahesh Chandra Sharma 
Date:  20110313 
Time limit:  0.211s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  Own problem used for NSITIIITA main contest #7 