CF582D.Number of Binominal Coefficients
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
For a given prime integer p and integers α,A calculate the number of pairs of integers (n,k) , such that 0<=k<=n<=A and is divisible by pα .
As the answer can be rather large, print the remainder of the answer moduly 109+7 .
Let us remind you that is the number of ways k objects can be chosen from the set of n objects.
输入格式
The first line contains two integers, p and α ( 1<=p,α<=109 , p is prime).
The second line contains the decimal record of integer A ( 0<=A<10^{1000} ) without leading zeroes.
输出格式
In the single line print the answer to the problem.
输入输出样例
输入#1
2 2 7
输出#1
3
输入#2
3 1 9
输出#2
17
输入#3
3 3 9
输出#3
0
输入#4
2 4 5000
输出#4
8576851
说明/提示
In the first sample three binominal coefficients divisible by 4 are ,
and
.