wip
Time Limit: 1 seconds
Memory Limit: 256 MB
Rating: 1200
Problem StatementGiven a polynomial of degree $N$, print each coefficient of its simplest form from the highest power of $x$ (power $N$) to the lowest power of $x$ (power 0).
InputFirst line: $N$ $(1 \le N \le {10}^5)$ Second line: Polynomial expression (in string) It is guaranteed that the length of the string containing the polynomial will not exceed ${10}^6$ (Note: The polynomial might not in its simplest form and the powers of $x$ are not in order)
OutputOutput the coefficients of the polynomial from highest power to lowest power.
Sample CasesSample Input 1: 3 3x^3-6x^2+5x+12 Sample Output 1: 3 -6 5 12 Sample Input 2: 5 23x^5-17x+4x^4+9x^5-1 Sample Output 2: 32 4 0 0 -17 -1Explanation
The polynomial might have terms of the same power or terms in a different order than usual.
Sourcesbronze@HungJan@, silver@isaachew@
Submit | Back