No.3218 Night Equation
Story
"So it was you all along who were stopping the night..."
Problem Statement
In a certain world, the night has been lasting for an eternity because of the Spell of Everlasting Night.
There is a polynomial $f(x)=A_1x^N+A_2x^{N-1}+\cdots+A_Nx-1$. If there exists a positive real number $t$ satisfying $f(t)=0$, the night ends at time $t$. If no such number exists, the night does not end.
Determine whether dawn will come.
Input
$N$ $A_1\ A_2\ \cdots \ A_N$
- $1\leq N\leq 10^5$
- $0\leq A_i\leq 10^9$
- All inputs are integers.
Output
Print Yes if the night ends, and No otherwise, on $1$ line.
Print a newline at the end.
Sample
Sample 1
Input
2 1 2
Output
Yes
We have $f(x)=x^2+2x-1$. The real numbers $t$ satisfying $f(t)=0$ are $t=-1\pm \sqrt{2}$, and since $-1+\sqrt{2}$ is positive, the night ends at time $-1+\sqrt{2}$. Therefore, the answer is Yes.
Sample 2
Input
1 0
Output
No
We have $f(x)=-1$. Thus, there is no positive real number $t$ satisfying $f(t)=0$. Therefore, the answer is No.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
nauclhlt