#P3583. [POI 2015 R1] 平方和 Squares
[POI 2015 R1] 平方和 Squares
Description
Consider expressing a positive integer as a sum of several distinct squares. For example, , while has no such decomposition.
Let denote the minimal possible value of the largest base among all such decompositions of . If no such decomposition exists, set . For example: , , , .
A number is called "overweight" if and only if there exists such that . From the examples above, is an "overweight" number.
Given , you need to:
- Compute .
- Count how many "overweight" numbers are in the range from to .
Input Format
The input contains a single line with a positive integer .
Output Format
Output one line containing two integers, which are the answers to the two questions above. If , output a minus sign - instead.
30
4 15
Hint
Constraints
For 100 % of the testdata, .
Original title: Kwadraty.
Translated by ChatGPT 5
京公网安备 11011102002149号