Nune9 <amornsak....@gmail.com> writes: <snip> > I have a list is > > land = [10,20,30,40,110,50,18,32,5] > > and I want to find each values of summation (don't sorted values in > list) as It has highest possible > > example. > > I want to dividing N=3 part from list as above and divieded each part > has highest values that as possible. > *** (don't sorted values in list) > > first part has values is = 10, 20, 30, 40 > summation = 10+20+30+40 = 100 > > second part has values is = 110 > summation = 110 > > and third part has values is = 50, 18, 32, 5 > summation = 105 > > that 100, 110 and 105 is highest values as possible in list by > dividing N=3 part.
So, given a sequence of numbers, you want to partition it into N consecutive sub-sequences such that the sums of these sub sequences is, somehow, maximal. I say "somehow" because there are various possible meanings for "highest" when applies to set of numbers. Have I got that part right? It would help if you clarified a couple of things. Are all numbers in the sequence always positive, and what makes one set of numbers "higher" than any other? I imagine you want the most equal partition -- the one that minimises the variance in the set of sums. > and then If I want to divide N(1,2,3,...,N) part from any numeric > list??? I don't understand this last bit at all. The repeated use of N is not helping me. -- Ben. -- https://mail.python.org/mailman/listinfo/python-list