CF493E.Vasya and Polynomial
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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
, and
, where
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.
瓦西娅正在读高中的最后一年,不久后他将参加考试。他决定学习多项式。多项式是一个函数 $ P(x) = a_0 + a_1 x^1 + \dots + a_n x^n $。其中,数 $ a_i $ 称为该多项式的系数,非负整数 $ n $ 称为该多项式的次数。
瓦西娅和他的朋友们打了个赌,声称自己能解决任何关于多项式的题目。朋友们给他出了一道题:“求满足以下条件的多项式 $ P(x) $ 的个数:其所有系数均为非负整数,且满足
,
以及
,
其中
和 $ b $ 是给定的正整数。”
瓦西娅不喜欢输掉赌注,但他完全不知道如何解决这个问题,因此请帮帮他解决这道题。
输入格式
The input contains three integer positive numbers
no greater than 1018.
输入包含三个不超过 1018 的正整数
。
输出格式
If there is an infinite number of such polynomials, then print "inf" without quotes, otherwise print the reminder of an answer modulo 109 + 7.
如果满足条件的多项式有无穷多个,则输出 inf(不带引号);否则输出答案对 109+7 取模后的余数。
输入输出样例
输入#1
2 2 2
输出#1
2
输入#2
2 3 3
输出#2
1
输入解题思路,AI测评打分。不知道怎么写?