← All problemsSign in

Super Hero

CodeChefRating 1824Open on judge ↗

Chef is playing a game where he battles monsters to defeat as many as possible. He starts with an initial health of $H$ units, which can decrease with each battle. In each battle: 1. Chef's current health, $P$, will **drop to** $D$ after the fight, where $D$ is the largest [divisor](https://en.wikipedia.org/wiki/Divisor) of $P$ other than $P$ itself. 2. The game ends when Chef’s health reaches $1

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