Official algorithmic problem description and constraints.
Chef is playing a game consisting of N rounds. In each round he rolls a regular six faced dice.
He starts with an initial score of 0. Let the number rolled by him in a particular round be X.
If this is not the first round and the previous number rolled was 1, Chef will add 2β 2β X to his score, otherwise he will add X to his score.
For example, if the game has 6 rounds and the rolls are [2,1,6,1,1,4] in the given order, his score will be 2+1+(2β 6)+1+(2β 1)+(2β 4)=26.
Find the maximum possible score he can obtain after N rounds.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.