luogu P2481 [SDOI2010] Code auction

luogu

Title that must be a number of large numbers of several 1+ 3 2 + ... + number 9 composed of several apparently can be converted into 9 \ (\ underbrace {111 ... 1 } _ {a_i a 1} (0 \ le a_1 \ le a_2 \ le a_3 ... \ le a_9, a_9 = n) \) sum

Module 500 then, all the processing can be considered \ (\ mod p = i \ ) of different lengths \ (1 ... 111 \) number referred to as \ (cnt_i \) , dp consider seeking the answer, provided \ (f_ {i, j, k} \) represents consideration before \ (I \) remaining class, with the \ (J \) a \ (1 ... 111 \) , to give the number of \ (\ MOD p = k \) scheme. Note that the elected \ (1 ... 111 \) different if and only if the corresponding \ (a \) after different ordered sequence, and only mode \ (P \) identical \ ( 111 ... 1 \) possible impact. transfer enumerate the current class selected a number of j, then transfer coefficient is \ (cnt_i \) several selected \ (j \) a program, this is equivalent to \ (\ + J cnt_i-Binom {} {J}. 1 \) , the final answer is \ (f_ {p-1,8, p - (\ underbrace {111 ... 1} _ {n number 1} \ mod p )} \) , because there is no leading zero, to include at least one \ (\ underbrace {111 ... 1 } _ {n 1} th \)

code

Guess you like

Origin www.cnblogs.com/smyjr/p/11318054.html