结合价值创造一堆100 [关闭]

suppose I have one array having the values:

array(20,40,30,15,60,50,10)

Now what i want is to I need to create bunch of 100 or near to hundred.and create separate round for each set of 100(or near to 100).

Say

Case 1:
Round 1: array(60,30,10) // 100 or near to 100
Round 2: array(40,50)    // 100 or near to 100
Round 3: array(15,20)    // 100 or near to 100 or remaining

Case 2:
Round 1: array(60,40)    // 100 or near to 100
Round 2: array(50,20,30) // 100 or near to 100
Round 3: array(15,10)    // 100 or near to 100 or remaining

So how can I achieve this?

Is there any algorithm regarding this that I can study?

You are describing the binpacking problem, which is NP-Complete, thus there is no known polynomial solution to solve it.

You can try an exponential approach (check all possibilities) if you need exact. If you want "close enough" you can search the literature for some approximation algorithm, or use some heuristic search solution from the AI field such as Genetic Algorithm or Hill Climbing.