302554: CF493E. Vasya and Polynomial
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Vasya and Polynomial
题意翻译
给定$1<=t,a,b<=10^{18}$,求有多少个多项式$P(x)=\sum a_i* x ^i(a_i\in N)$ 满足 $P(t)=a,P(a)=b$ 无穷解输出 `inf`,否则输出答案对 $10^9+7$ 取模的值。题目描述
Vasya is studying in the last class of school and soon he will take exams. He decided to study polynomials. Polynomial is a function $ P(x)=a_{0}+a_{1}x^{1}+...+a_{n}x^{n} $ . Numbers $ a_{i} $ are called coefficients of a polynomial, non-negative integer $ n $ is called a degree of a polynomial. Vasya has made a bet with his friends that he can solve any problem with polynomials. They suggested him the problem: "Determine how many polynomials $ P(x) $ exist with integer non-negative coefficients so that ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF493E/7b06cb2e25bf991e4ece3c009304fa0e5ea4f3b3.png), and ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF493E/dde9c7b515169e25ed5a1052cd7c5bcde9412e7c.png), where ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF493E/9de2146b51b305e9def0e50de5b1876df09306e8.png) and $ b $ are given positive integers"? Vasya does not like losing bets, but he has no idea how to solve this task, so please help him to solve the problem.输入输出格式
输入格式
The input contains three integer positive numbers ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF493E/6b6d1243d56d2406df8f119ac273cb7c4c23a8f9.png) no greater than $ 10^{18} $ .
输出格式
If there is an infinite number of such polynomials, then print "inf" without quotes, otherwise print the reminder of an answer modulo $ 10^{9}+7 $ .
输入输出样例
输入样例 #1
2 2 2
输出样例 #1
2
输入样例 #2
2 3 3
输出样例 #2
1