I am stuck on this problem that I have been trying to work for a while i am just looking for some direction because I'm lost and I don't know how to approach it.
Problem:
The program needs to find the max score of a given string that is no longer then 90 digits long.
Constraints:
There can't be a number larger then a 10 digit number in any section.
There is always only 9 sections.
So the string that is read in has to be at least 9 digits long and less then 90 digits long.
Test cases:
Suppose the user typed in:
630240001
Then the output should be:
Total Score: 16
Linescore: 6 3 0 2 4 0 0 0 1
As another example, suppose the user typed in:
6302490001
Then the output should be:
Total score: 106
Linescore: 6 3 0 2 4 90 0 0 1
As another example, suppose the user typed in:
1020304050607098765432100070070012356821349976527193492134569234
Then the output should be:
Total Score: 38909601745
Linescore: 1020 3040506070 9876543210 00 7007001235 6821349 9765271934 9213456923 4
As another example, suppose the user typed in:
909009000900009000009000000900000009000000009000000009000000000
Then the output should be:
Total Score: 36990099099
Linescore: 9090090009 0 000 9000009000 000 9000000090 000000 0900000000 9000000000
Note: The score is made by adding each section of the linescore up.
I'am sorry i forgot to put that each task gets added to make up the total score.
The first test case shows the smallest case in which the string entered in is only 9 digits long.
The largest case and the smallest case are really easy to find by just splitting the string, then converting the string to an array of int, then adding the 9 integers up.
I believe I understand this problem. bigJoe, I suggest that you post a direct link to the source of problems for posts like this in the future. No offense but you did a poor job of explaining.
Based on your descriptions and examples I believe I have deduced the correct parameters and objectives of the problem. Correct me if I'm wrong.
Provided with a string of length >= 9 and <= 90, it is possible to divide the string into exactly nine partitions, each of length >= 1 and <= 10. The score is the sum of the partitions. The objective is to partition the string such that the sum of partitions is maximized.