← CSES Better

Training - INOI 2017

INOI · 2017 · Indian National Olympiad in Informatics · TINOI17B

Open official problem ↗
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

dynamic-programming · state-transition

The organizer’s problem statement is available at the official source link.

training states

Each city offers training or a battle

In each city, Ash chooses training or a battle. Training raises strength by (sum of its decimal digits)^3; battling adds current strength times that city?s E[i] to experience.

State table
Action in city iStrength after actionExperience change
trainS + digitSum(S)^30
battleSS * E[i]
  1. 1

    Track strength and experience

    State values are Pikachu strength S and accumulated experience XV.
  2. 2

    Choose one action per city

    Training changes S to S + (digitSum(S))^3; battling changes XV to XV + S*E[i].
  3. 3

    Maximize final experience

    Process cities in order and choose actions giving the largest XV after city N.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 chars

Run output

Run your code to see output.