The problem is the following:
You are given a set of positive integers { a1 , a2 , a3 , ... , an } in which there are no same numbers ( a1 exists only once ,a2 exists only once,...) eg A = {12 , 5 ,7 ,91 }.
Question: Are there two disjoint subsets of A , A1 = { b1,b2,...,bm } and A2 = { c1,c2,...,ck} so that b1+b2+...+bm = c1+c2+...+ck ?
Note the following: It is not obligatory for A1 and A2 to cover A, so the problem isn't automatically reduced to the subset sum problem.
eg A = {2,5,3,4,8,12}
A1= {2,5} so sum of A1 is 7
A2= {3,4} so sum of A2 is 7
We found two disjoint subsets of A with the described property so the problem is solved.
How can I solve this problem? Can I do something better than find all possible (disjoint)subsets, calculate their sums and find two equal sums?
Thank you for your time.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…