UVa 11258 - String Partition

This is a classical DP problem. Many ways to solve it but the simplest is to memoize on a 1D DP. Let say a function f(i) returns the largest possible answer if the sequence of characters is a(i) a(i+1). . . a(n) for a string a(0) a(1) ...a(n).

Then f(i)= if(s[i]=='0')f(i+1), else MAX(for (all possible 32bit signed integers starting from i) + f(k)). where k is the index after the integer is formed.