Maximize the sum of GCDs (Greatest Common Divisors) of a bipartition?
问题 Given an array of positive numbers. I want to split the array into 2 different subset(s) such that the sum of their gcd (greatest common divisor) is maximum. Example array: {6,7,6,7} . Answer: The two required subsets are: {6,6} and {7,7} ; their respective gcd(s) are 6 and 7, their sum = 6+7=13 ; which is the maximum gcd summation possible. Gcd: Gcd of {8,12} is {4} as 4 is the greatest number which divides 8 as well as 12. Note: gcd(X)=X in case the subset contains only one element. My