#P4598. [HEOI2012] Akai 的数学作业
[HEOI2012] Akai 的数学作业
Description
On the blackboard remains a piece of math homework Akai once did. It is actually not a very difficult problem:
"Given a univariate polynomial equation of degree :
Find all rational solutions of this equation."
Akai still vividly remembers the nights he stayed up solving it. He even remembers how much scrap paper he wasted. But he just can’t recall the final answers. Can you help him?
Input Format
The first line contains an integer . The second line contains integers, representing to .
Output Format
Output an integer on the first line, the number of rational solutions. Then output lines, each containing one solution. Each solution must be printed as a fraction in lowest terms, with a positive denominator. If a solution is an integer, output the integer directly. Equivalent solutions should be output only once. Output all solutions in increasing order.
3
-24 14 29 6
3
-4
-3/2
2/3
Hint
- For 30% of the testdata, .
- For 100% of the testdata, , , .
HEOI 2012 Day 1 Task 1.
Translated by ChatGPT 5
京公网安备 11011102002149号