|
|
back to boardC# - AC Hi, Well, the only thing to keep in mind for this problem is that final answer cannot be negative. If it comes to negative then output 0. Secondly, just start adding the numbers from the beginning and keep track of the maximum sum. For example, if you add first three terms and sum comes to 500 and then the fourth term is -500, then don't loose the previous 500 sum. Keep it somewhere, but make your new sum 0. Then start adding from 5th term (0 + 5th term + ....). Whenever you add just check whether the new one is greater than 500 or not ? If it is then replace it with that. Varun Edited by author 05.05.2009 11:30 Edited by author 05.05.2009 11:31 |
|
|