There are a bunch of coins on a table, laid out in a straight line.
Each coin has a (positive) value from
At every turn, you must remove a coin from one end of the line.
Turns alternate, so your friend goes immediately after you're done.
The game ends when there are no coins remaining.
An example game:
The coins start like this:
You always go first, so you take the
Your friend takes any of the
Now you can take the
Your score, in this case, is
(In this case, you can always beat your friend.)
Find the maximum possible score you can achieve.
Input Specification
Output Specification
Your maximum possible score, provided that you go first and your friend plays perfectly.
Comments