From Hunan Changsha training since the pit ... has not been filled out, today to solve the problem.
Reference:
1.http://www.cnblogs.com/var123/p/5523068.html
2.http://blog.csdn.net/qzh_1430586275/article/details/51893154
3.http://blog.csdn.net/check_check_check/article/details/52101467
First, the definition of Lucas ' theorem
(When and only if P is prime)
Very brief, see the application and related topics below.
Ii. the application of the Lucas theorem 1, [bzoj4591][shoi2015][super-energy particle cannon/change]
Title Description: AskC(N,0) + C (n ,1 ) +.+c (n, K) mod 2333
< span class= "Mo" > < span class= "Mo" > push to procedure:
Easy to get,
Primitive =C(N/2333,0)∗C(NMoD2333,0)+C(N/2333,0)∗C(NMoD2333,1)+...+C(N/2333,k/ 2333) ∗c (nmod2333 ,k Mod2333) MoD 2333
< Span class= "mn" > < span class= "Mo" >
Similar merger, divided into two parts: set K=K1*2333+K2 (0≤K1,K2) 1) for the K1 part of the first consideration of the situation of k1=0, you can derive the first item of these products is C (n/2333,0), it is proposed to get C (n/2333,0) *∑c (n%2333,i ) (wherein i∈[0,2333]) taking into account the situation of K1=1, C (n/2333,1) *∑c (n%2333,i) (where i∈[0,2333]) can be considered k1=2, C (n/2333,2) *∑c (n%2333,i) (where i∈[ 0,2333]) ... ··· ··· ··· ··· ··· Titus Common Divisor →→→∑c (n/2333,j) *∑c (n%2333,i) (where I∈[0,2333],J∈[0,K1)) Repeat 3 times ∑c (n/2333,j) *∑c (n%2333,i) (where i∈[0,2333],j∈[0,k1)) ∑C ( N/2333,J) *∑c (n%2333,i) (where i∈[0,2333],j∈[0,k1)) ∑c (n/2333,j) *∑c (n%2333,i) (I∈[0,2333],J∈[0,K1)) Roar, everybody wait, Look at the K2 section. 2) for K2 part of the original =c (N/2333,K1) *c (n%2333,0) +c (N/2333,K1) *c (n%2333,1) + +c (N/2333,K1) *c (n%2333,k%2333) =c (N/2333,K1) * (∑c (n%2333,i)) (where i∈[0,k%2333]), Ans=∑c (n/2333,j) *∑c (n%2333,i) ( which I∈[0,2333],j∈[0,k1) +c (N/2333,K1) * (∑c (n%2333,i)) (where i∈[0,k%2333]) said so much, so what is the use of this theorem? is obviously the modulus of the recursive solution combination number ~
So for this problem, we first preprocess a S (n,k) =∑c (n,i) (I∈[0,k]) (of course, in the final mod p sense), Ans=s (n%2333,2332) * (∑c (N/2333,J)) (J∈[0,K1)) + C (n/2333, K1) *s (n%2333,k%2333)
Ans in the S () must be two-dimensional things in the specified time and space, and ∑c (N/2333,J) is our super-particle cannon ' modified sub-problem, recursive solution can be, another, C (N/2333,K1) can also be used with Lucas theorem recursive return solution
So the problem was verbal AC.
Lucas Theorem and combinatorial mathematics