I've created a program that sums up all possible individual sub-strings of given data. For example: 1 1 2 2 should return 30 because,
1
1 + 1
1 + 1 + 2
1 + 1 + 2 + 2
1
1 + 2
1 + 2 + 2
2
2 + 2
2
Sums up to 30, now the problem isn't creating such a program, the issue is when the big (10^15) numbers come in when there can be as many as 10^5 of them. Now my question is: How do I deal with such numbers? I can only use standard library, so no GMP for me unfortunately and I'm also forced to run on GCC 4.4.4 which makes it even worse.