#P2674. 《瞿葩的数字游戏》T2-多边形数
《瞿葩的数字游戏》T2-多边形数
Description
This is a pattern-finding problem. Please discover the pattern yourself to practice mathematical induction!!
Let’s take triangular numbers as an example: the numbers , , , in the figure are triangular numbers.

Task: determine which kinds of polygonal numbers belongs to (assume is a -gonal number). For example, we can find that is both a triangular number and a square number. If it is not a polygonal number, output Poor + that number. If it is multiple types of polygonal numbers at the same time, output the smallest and the second smallest . Each input file contains test cases.
Input Format
First a number , then lines, each containing one integer.
Output Format
Output lines. For each , output the corresponding and . If is not a polygonal number, output Poor + that number (no spaces in between).
2
36
1000000
3 4
4 204
Hint
Constraints and Notes
For of the testdata, .
For of the testdata, , .
If is multiple types of polygonal numbers at the same time, let be the smallest , and be the second smallest .
King : "Can you discover the pattern that square numbers are just perfect squares? To make it easier to understand, I’ll provide a table of the first few polygonal numbers." (From the table you can see that a regular hexagon does not include the very center point, and similarly for others.)
| Natural numbers | ||||||||
|---|---|---|---|---|---|---|---|---|
| Triangular numbers | ||||||||
| Square numbers | ||||||||
| Pentagonal numbers | ||||||||
| Hexagonal numbers |
Translated by ChatGPT 5
京公网安备 11011102002149号