#P1214. [USACO1.4] 等差数列 Arithmetic Progressions
[USACO1.4] 等差数列 Arithmetic Progressions
Description
An arithmetic progression is a sequence that can be written as .
In this problem, is a non-negative integer and is a positive integer. Write a program to find arithmetic progressions of length within the set of bisquares:
$$\{ x | x = p^2 + q^2 \wedge p,q \in \mathbb N \cap [0,m]\}$$Input Format
The first line contains a positive integer , the required length of the progression. The second line contains a non-negative integer , the upper bound for .
Output Format
If no progression is found, output NONE.
If found, output one or more lines, each containing two integers: .
These lines should be sorted in ascending order by as the primary key and by as the secondary key.
There will be no more than 10,000 such arithmetic progressions.
5
7
1 4
37 4
2 8
29 8
1 12
5 12
13 12
17 12
5 20
2 24
Hint
Constraints For 100% of the testdata, , .
Problem translation from NOCOW.
USACO Training Section 1.4.
Translated by ChatGPT 5
京公网安备 11011102002149号