33 lines
516 B
Markdown
33 lines
516 B
Markdown
# 极值问题
|
||
|
||
## Tags
|
||
|
||
- C++一本通
|
||
- 递推
|
||
|
||
## Description
|
||
|
||
已知$m$、$n$为整数,且满足下列两个条件:
|
||
|
||
1. $m,n\in\left\{1,2,\cdots,k\right\}$,即$1\le m,n\le k$
|
||
2. $(n^2-m\times n-m^2)^2=1$
|
||
|
||
你的任务是:编程输入正整数 $k$($1\le k\le 10^9$),求一组满足上述两个条件的$m$、$n$,并且使$m^2+n^2$的值最大。例如,输入$k=1995$,则输出:$m=987$ 和 $n=1597$
|
||
|
||
## Example Cases
|
||
|
||
### Case 1
|
||
|
||
#### Input
|
||
|
||
```
|
||
1995
|
||
```
|
||
|
||
#### Output
|
||
|
||
```
|
||
m=987
|
||
n=1597
|
||
```
|