luogu#P1679. 神奇的四次方数
神奇的四次方数
Background
With your help, v 神 (v shen) finally found the most suitable university for a classmate, and now it is time to inform them. The classmate in charge of the contact network in the class is dm, so v 神 went to find dm. However, dm was busy studying an interesting math problem. To invite dm to help, v 神 asked you to solve this problem.
Problem Description
Decompose an integer into a sum of fourth powers, with being as small as possible. For example, when , since , we have . It can be proven that in this case is minimal.
Input Format
One line, an integer .
Output Format
One line, an integer .
706
2
Hint
Constraints
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5