I am stuck on this problem http://www.spoj.com/problems/MINUS/ and after searching the topcoder forum http://apps.topcoder.com/forums/?module=Thread&threadID=699255&start=0&mc=11#1336125 I can tell whether sum m(given in problem) can be formed or not,But I am not getting How to find which i to choose first for performing operations?? Any help will be appreciated!
-a + b + c + d + e + ... = -(a - b - c - d - e - ...)
. Knowledge of this formula is pretty enough to solve your problem...UPD. Hint: you don't need to use nested parentheses.