Give N, M, obtain the final summation sequence an=c (n-1,0) *x1 + C (n-1,1) *x2+...+c (n-1,n-1) *xN;
If Xi is not related to M, the remainder of an divided by M is not related to Xi, i.e. the remainder does not contain the term XI;
Input: N,m
Output: The total number of ans//unrelated items;
Xi1 xi2 ...//unrelated items, ascending
Tips:
The unique decomposition theorem for combinatorial numbers
Because the number of 10^5-level combinations is bound to be large (long long or even double cannot be saved), it is required that the unique decomposition can only take a recursive step-down decomposition, the code is as follows:
BOOLCheckintNintJ//calculates the exponent of the unique decomposition of C (N, j) According to the recursive formula{ intnum = fac[0][0];//This is the total number of element factors calculated for the previous step intA = N-j +1; intb =J; for(inti =1; I <= num; i++) { intp = fac[i][0]; int&q =Fac_c[i]; ///calculate the decomposition index for(; a%p = =0; A/= p, q++); for(; b%p = =0; b/= P, q--); }}
After the completion of the comparison between the factor index and the M-only decomposition of the corresponding exponent size can be
"The unique decomposition theorem of combinatorial number" Uva1635