← All problemsSign in

Monsters

CodeChefRating 1527Open on judge ↗

Ben is fighting a monster with a health of $H$. He starts with an attack power of $1$. Ben has two types of moves: - He can use a *regular attack*, which damages the monster by his current attack power. After this, his attack power **doubles**. - He can use a *special move*: choose a **prime number** $P$ such that $P \leq H$ ($H$ being the current health of the monster), and deal $P$ damage to

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start