AtCoder Beginner Contest 420
G
sqrt(n²+n+X)
AtCoder
⌀ 1427
原题
翻译中…

Problem Statement

翻译中…

You are given an integer $X$.

翻译中…

Find all integers $n$ such that $\displaystyle \sqrt{n^2+n+X}$ is an integer.

翻译中…

Constraints

翻译中…
  • $-10^{14} \le X\le 10^{14}$
  • The input value is an integer.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

X

翻译中…

Output

翻译中…

Let $N_1,N_2,\ldots,N_K$ be the integers $n$ such that $\displaystyle \sqrt{n^2+n+X}$ is an integer, listed in ascending order (where $K$ is the number of $n$ satisfying the condition). Output in the following format:

翻译中…

K
N_1 N_2 \ldots N_K

翻译中…

样例

Input #1
4
Output #1
4
-4 -1 0 3
There are four integers $n$ such that $\sqrt{n^2+n+4}$ is an integer: $n=-4,-1,0,3$.
Input #2
-10000
Output #2
8
-10001 -773 -593 -101 100 592 772 10000
Input #3
20250824
Output #3
8
-20250824 -4050164 -13304 -884 883 13303 4050163 20250823
题目信息
题号
abc420_g
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。