Maximum score of a linescore

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.
Last edited on
no longer then 90 digits
less then 90 digits long

Ambiguous.

always only 9 sections

Does that mean "exactly" or "at most"?

We have no idea how the "Total score" is computed.

A "split string into pieces" task?
There is exactly 9 "task's"

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.

------Examples------
Input:
630240001
Output:
6+3+0+2+4+0+0+0+1 = 16

Input:
6302490001
Output:
6+3+0+2+4+90+0+0+1 = 106

Input:
1020304050607098765432100070070012356821349976527193492134569234
Output: 1020+3040506070+9876543210+00+7007001235+6821349+9765271934+9213456923+4 = 38909601745

Browni sorry for my horrible explanation i was working on this very late last night, but you have the right idea.
What have you tried so far? Can you post your code with an explanation?

Are you familiar with any of these techniques?
Dynamic programming, memoization, recursion.
Last edited on
Topic archived. No new replies allowed.