DP top down problem

Правка en1, от myaw, 2015-08-26 01:37:05

The problem look like this : we have n object each object have a weight .

We want to create 2 groups of these objects so the number of objects on the two teams must not differ by more than 1 ans the total weight of the objects on each group should be as nearly equal as possible.

example n = 4 : 1 2 3 4 => ans : 5 5

n = 4 : 1 2 3 11111 => ans : 5 11112

    n = 3 : 100 90 200 => ans :190 200

my code works fine for small input how ever it gives negative values for large input (n >= 25 ) . My code

You should now that n<=100 and the sum of weights is <= 1e6 .

Теги dp, dynamic programming, help

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский myaw 2015-08-26 01:46:02 23
en2 Английский myaw 2015-08-26 01:42:33 11
en1 Английский myaw 2015-08-26 01:37:05 641 Initial revision (published)