#T398. 极值问题
极值问题
Description
Given that m and n are integers satisfying the following two conditions:
① m, n ∈ {1, 2, ..., k}, i.e., 1 ≤ m, n ≤ k
② (n² - m·n - m²)² = 1
Your task is: Write a program that takes a positive integer k (1 ≤ k ≤ 10⁹) as input and finds a pair (m, n) that satisfies the above two conditions while maximizing the value of m² + n².
For example, if the input is k = 1995, the output should be: m=987 n=1597.
Input Format
A positive integer k (1 ≤ k ≤ 10⁹).
Output Format
Output m and n, following the sample output format.
1995
m=987
n=1597
翻译结果
CodesOnline
(注:根据提供的源文本 "CodesOnline" 为专有名词/品牌名,通常保持原样不翻译。若需进一步调整请说明具体上下文。)