R.A.X's blog

By R.A.X, 10 years ago, In English

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!

Tags spoj, dp
  • Vote: I like it
  • -6
  • Vote: I do not like it

»
10 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

-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.