118 - ZOJ Monthly, July 2012 - F
There are n cities(1, 2, ... ,n) forming a line on the wonderland. city i and city i+1 are adjacent and their distance is 1. Each city has many gold coins. Now, Alice and her friend Bob make a team to go treasure hunting. They starts at city p, and they want to get as many gold coins as possible in T days. Each day Alice and Bob can move to adjacent city or just stay at the place, and their action is independent. While as a team, their max distance can't exceed M.
The input contains multiple cases.
Output the how many gold coins they can collect at most.
6 3 1 2 3 3 5 4 2 1
At day 1: Alice move to city 2, Bob move to city 4.
Author: LI, Chao