The Race

Source: Project Euler 232

  1. Read the problem and summarise the task requirements.
  2. Player 2 can choose a value of T on each move. What values should they choose from?

There is a natural characterisation of each step of the game.

  1. Define appropriate subproblems to represent the game state.
  2. Propose a recurrence between these subproblems.
  3. In what order should you solve the subproblems?
  4. Design an algorithm to solve the problem.

  5. Analyse the time complexity of your algorithm and estimate its running time.

  6. Implement this algorithm in code.
  7. Submit your output for judging!