The ex given n ( number of problems), L (time of one day) , C ( a cont to calculate thi DIs).

The input given us n, L, C, and an timeArr[] included the time need to solve the problem i.

For example.

The input

10

120 10

80 80 10 50 30 20 40 30 120 100

That mean we have n=10 prolble have to solve, L=120, C=10, and an array mean , we need 80 time to solve problem 1, 80 to solve probem 2, 10 to solve problem 3....

All the problem need to solve step by step

We need to find out the shortest day to solve all the problem and the DI must be minumun.

The DI is the rest time of one day...

lớp bằng giá trị DI như sau:

DI=0 when t=0

DI=-C when 1<=t<=10

DI=(t-10)^2 when t>10

t = the rest time of one day.

In that example, we must calculate that need minimux 6 day to solve all the problem, and group that (80) (80) (10,50,30) (20,40,30) (120) (100)

t1=120-80=40

t2=120-80=40

t3=120-10-50-30=30

.....

So the result of this example is 6 day and minDI is 2700.

================================================== ====================================

I could not have any algorthym for this ...

Can you help me!!!!

Thanks alot