The maximum value
Practice
4.2 (9 votes)
Basic math
Algorithms
Math
Problem
78% Success 2493 Attempts 30 Points 2s Time Limit 256MB Memory 1024 KB Max Code
For a provided integer \(k\), find the maximum value of \(m+n\), where \(1 \leqslant m,n \leqslant k\) and \((n^2 - nm - m^2)^{2} = 1\).
Note: The answer can exceed the range of a 32-bit integer.
Input format
The only line of the input contains one integer \(k\).
Output format
Print the maximum value of \(m+n\), where \(1 \leqslant m,n \leqslant k\) and \((n^2 - nm - m^2)^{2} = 1\).
Constraints
\(1 \leqslant k \leqslant 10^{18}\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
7 votes
Tags:
Basic MathEasy-MediumMathematicsMathematics
Points:30
1 votes
Tags:
Easy-MediumEasy
Points:30
9 votes
Tags:
Basic MathAlgorithmsMath
Editorial