#P2232. [HNOI2002] 填数游戏
[HNOI2002] 填数游戏
Description
A store recently launched a promotional event with prizes for solving questions. The manager posted several challenging problems on the store’s bulletin board, and if you can solve any one of them, you can obtain the right to purchase goods at a discount. After some time, most problems were solved by customers, but there was one problem that stumped everyone. It is described as follows:
Fill every cell of an rectangular grid with distinct perfect squares, such that the sum of each row and each column is also a perfect square (each such sum must be less than ). Please find a valid arrangement.
Tiger hopes to earn the discount, so he turns to you, who are preparing for NOI 2002, and asks you to design a program to find a valid arrangement.
Input Format
The input consists of a single line with two positive integers ().
Output Format
If a solution exists, output lines, each containing numbers that represent a valid arrangement. If there is no solution, output No answer.
2 2
225 1296
400 2304
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号