The topic is very understood, test instructions is for you n! and the K-suffix zero, allowing you to find the number of binary B that fits the criteria.
Suppose you've already asked for a n! decomposition, and then explained the first set of examples. n=10,k=2,n! The factorial can be expressed as 2^8*3^4*5^2*7, and then converted into this form (2^4*3^2*5) ^2*7, you can know how many kinds of feed to meet the conditions, that is, the combination of 2^4*3^2*5, there are 5*3*2 species, which must not meet the conditions, 2^0,2^1,2^2,3 ^0,3^1,5^0, there are 3*2*1 species, 30-6 equals 24 species. Why not meet the conditions, because if there is that kind of system will produce the extra 0.
The code is as follows
#include <cstdio>#include <cstring>using namespace STD;Const intMAXN =10000;typedef Long LongLL;ConstLL mod =1000000000+7;intT LL n,k;intPRI[MAXN],NUM[MAXN],VIS[MAXN];intCnt=1;intPrime () {memset(Vis,0,sizeofVIS); for(inti =2; i<10000; i++)if(!vis[i]) {pri[cnt++]=i; for(intJ=i+i; j<10000; J+=i) vis[j]=1; }}intSolveintNintP) {if(n<p)return 0;returnN/p+solve (n/p,p);}intMain () {prime ();//for (int i=1; i<=cnt; i++)//printf ("%d\n", Pri[i]); scanf("%d", &t); while(t--) {memset(Num,0,sizeofNUM);scanf("%i64d%i64d", &n,&k); LL ans =1, ans1 =1;intI for(i=1; i<=cnt; i++) {inttt = n; Num[i]=solve (Tt,pri[i]);if(num[i]>=k) {LL temp = num[i]/k+1; Ans = (ans*temp)%mod; LL Temp1 = temp-1;intjs=0; for(intj=1; j<=temp1; J + +) {if(num[i]/j!=k) js++; } ans1 = (ans1* (js+1))%mod;//printf ("%i64d\n", ans1);}Else Break; }printf("%i64d\n", ((ans-ans1)%mod+mod)%mod); }}
FZU2164 Jason ' s problem