|
|
вернуться в форумTo everyone : Algorithm to solve this problem ! Very easy ! calculate : fmax(n) = max(fmax(n-1)+value(n),value(n)); Re: To everyone : Algorithm to solve this problem ! Very easy ! Послано D_T_F 23 мар 2009 04:24 Why? Consider p1 = 5, p2 = -2 fmax(1) = 5 fmax(2) = max( 5+(-2), -2 ) = 3 But if i = j = 1 fmax(2) = 5 Or I got wrong understanding of the task? Re: To everyone : Algorithm to solve this problem ! Very easy ! F[i] is max values of sequence with the final element is a[i]. Finally, answer will be max( F[1], ... F[n] ). Sorry because of English. Re: To everyone : Algorithm to solve this problem ! Very easy ! It's wrong algorithm and more hard than right. |
|
|