← All problemsSign in

Minimum Digit Sum 2

CodeChefRating 2859Open on judge ↗

_This problem is similar to the problem "MNDIGSUM". The only differences are in the constraints and in the input format. In this problem the range for the base $B$ is $[2, R]$, the value of $n$ can be upto $10^{12}$ and the total number of queries is at most $300$. The differences are described in bold._ Let $f(n, B)$ be the sum of digits of the integer $n$ when written in base $B$. More formal

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