Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopdynamic-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.
| Action in city i | Strength after action | Experience change |
|---|---|---|
| train | S + digitSum(S)^3 | 0 |
| battle | S | S * E[i] |
- 1
Track strength and experience
State values are Pikachu strength S and accumulated experience XV. - 2
Choose one action per city
Training changes S to S + (digitSum(S))^3; battling changes XV to XV + S*E[i]. - 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 charsRun output
Run your code to see output.