← All problemsSign in

Sum of Digits

Let $S(N)$ denote the sum of digits of a positive integer $N$. You are given three positive integers $X$, $Y$ and $Z$. Consider all triples of positive integers $(A, B, C)$ such that: - $S(A+B)=X$ - $S(B+C)=Y$ - $S(C+A)=Z$ Your task is to find the triple which maximises $S(A+B+C)$ and the triple which minimises $S(A+B+C)$. Specifically, you are given an additional integer $P$ with the follow

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