N cells are located around a circle. Cells are numbered 1 through N in the clockwise direction.
Initially, you can place a token into any one of these cells.
In each turn, you look at the number of the cell containing the token and you calculate s, the sum of the digits in that number. You then move the token s cells clockwise.
This process continues until you move the token into a cell that already contained the token before. Your score is the number of cells that were visited by the token at least once during the process (including the initial cell).
Given N, return the maximal possible score you can get. |