No.1567 Integer Coefficient Equation
タグ : / 解いたユーザー数 21
作問者 :
PCTprobability
/ テスター :
Problem Statement
Find the number of integers $k$ between $L$ and $R$, inclusive, that satisfy the following condition. (13:34 Corrected from "positive integer" to "integer")
- There exists a polynomial $f(x)$ with integer coefficients such that the equation $f(x) = P$ has at least $5$ distinct integer solutions and $f(x) = k$ has an integer solution.
You are given $T$ test cases; find the answer for each of them.
Input
$T$
$P_1 \quad L_1 \quad R_1$
$P_2 \quad L_2 \quad R_2 $
$\vdots$
$P_T \quad L_T \quad R_T$
- All inputs are integers.
- $1 \le T \le 10^5$
- $|P_i,L_i,R_i| \le 2 \times 10^5$
- $L_i \le R_i$
Output
Output $T$ lines. On the $i(1 \le i \le T)$-th line, output the answer for the $i$-th test case.
Sample
Sample 1
Input
1
13 69 70
Output
1
An example of a polynomial $f(x)$ with integer coefficients such that $f(x)=13$ has at least $5$ distinct integer solutions and $f(x)=69$ has an integer solution is $2 x^5 - 16 x^4 + 2 x^3 + 236 x^2 - 544 x + 333 $.
It can also be proved that there is no polynomial $f(x)$ with integer coefficients such that $f(x)=13$ has at least $5$ distinct integer solutions and $f(x)=70$ has an integer solution.
Therefore, the answer for this case is $1$.
Sample 2
Input
4 8 17 28 -101 -164 -139 -217 -78 -8 9 -110 -59
Output
4 11 35 25
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。