No.1383 Numbers of Product
Problem Statement
You are given integers $\ N,K,M\ $.
For an integer $\ X\ $ greater than or equal to $\ 1\ $, define $\ f(X)\ $ as follows.
-
The number of pairs $\ (A,B)\ $ of integers greater than or equal to $\ 1\ $ satisfying $A(A+K)(A+2K) \cdots\ (A+BK)=X\ $
For example, when $\ K=1\ $, we have $\ f(12)=1\ $. When $\ (A,B)=(3,1)\ $, we get $\ A(A+K)(A+2K) \cdots\ (A+BK)=3(3+1)=12\ $, which satisfies the condition.
Consider the integers $\ X\ $ between $1\ $ and $\ N\ $, inclusive, such that $\ f(X)=M\ $. Find the number of such $\ X\ $.
Input
$N\ K\ M$
- $1 \leq N,K,M \leq 10^{18}$
- All input values are integers.
Output
Given $N,K,M\ $, consider the integers $\ X\ $ between $\ 1\ $ and $\ N\ $, inclusive, such that $\ f(X)=M\ $. Output the number of such $\ X\ $, followed by a newline.
Sample
Sample 1
Input
6 1 1
Output
1
Consider $\ f(X)\ $ for the integers between $\ 1\ $ and $\ N\ $, inclusive, and such that $\ f(X) \geq 1\ $, denoted by $\ X\ $.
・$\ f(2)=1\ $. $\ (A,B)=(1,1)\ $ satisfies the condition.
・$\ f(6)=2\ $. $\ (A,B)=(2,1),(1,2)\ $ satisfy the condition.
Therefore, the only $\ X\ $ between $\ 1\ $ and $\ N\ $, inclusive, such that $\ f(X)=1\ $ is $\ 2\ $.
Sample 2
Input
1 1 1000000000000000000
Output
0
The answer may be $\ 0\ $.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
蜜蜂