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}\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
3 votes
Tags:
MathematicsApprovedSimple-mathEasy-MediumMathematicsMathamatics
Points:30
5 votes
Tags:
MathematicsBasic MathMath
3.ZrZr
Points:20
90 votes
Tags:
ApprovedEasyFactorizationMathNumber TheoryOpen
Editorial
Login to unlock the editorial