Chef and Magic Numbers
Chef is the cleverest man in the whole world. However he is not interested in science, give him the magic. His first magic lesson consists of converting a number k to F(k) where F(k) - is the k-th magic integer. An integer is magic if S(n) is smaller than or equal to q. S(n) is the sum of squares of the digits in n. For example, S(13) = 1^2 + 3^2 = 10. Now Chef want to test his magical abilities.
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.
Sign in to chat with the tutor and save your progress.
Sign in to start