← All problemsSign in

Division

CodeChefRating 1923Open on judge ↗

Chef has an integer $N$. He repeats the following operation until $N$ becomes $1$. - Chef chooses an integer $X$ such that $X \gt 1$ and $X$ is a divisor of $N$ and then divides $N$ by $X$ (the new value of $N$ becomes $N/X$). If $X$ is even, Chef gets $A$ points otherwise he gets $B$ points Can you find the maximum points Chef can get if he performs the operations optimally? ### Input - First

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