← All problemsSign in

Sum of Powers

You are given two integers $X$ and $N$. Find the number of ways that the given integer, $X$, can be expressed as the sum of the $N^{th}$ powers of unique, natural numbers. For example, if $X = 13$ and $N = 2$, we have to find all combinations of unique squares adding up to $13$. The only solution is $2^2 + 3^2 = 13$. ### Input - The first line contains an integer, $X$. - The second line

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