Formula phobia patient membrane a half-day Qaq
The specific process see the other online bar >_<
1#include <cstdio>2#include <iostream>3#include <cstring>4#include <algorithm>5 #definell Long Long6 #defineMOD (x) x-=x>=modd?modd:07 using namespacestd;8 Const intModd=2333;9 intc[modd][modd],sum[modd][modd];Ten ll N,k; One A - -InlineintLucas (ll A,ll b) { the if(A<B)return 0; - if(a<modd&&b<modd)returnC[a][b]; - returnC[a%modd][b%modd]*lucas (a/modd,b/modd)%modd; - } + intCalc (ll n,ll k) { - if(k<0)return 0; + return(Calc (n/modd,k/modd-1) *sum[n%modd][2332]+lucas (n/modd,k/modd) *sum[n%modd][k%modd])%modd; A } atInlinevoidPrerun () { -Registerinti,j; - for(i=0; i<modd;i++) c[i][0]=sum[i][0]=sum[0][i]=1; - for(i=1; i<modd;i++) - for(j=1; j<=i;j++) -c[i][j]=c[i-1][j]+c[i-1][j-1],mod (C[i][j]), insum[i][j]=sum[i][j-1]+C[i][j],mod (Sum[i][j]); - for(i=1; i<modd;i++) for(j=i+1; j<modd;j++) sum[i][j]=sum[i][j-1]; to } + intMain () { -Prerun ();intT; the for(SCANF ("%d", &t); T t--) *scanf"%lld%lld", &n,&k), printf ("%d\n", Calc (n,k)); $ }Panax Notoginseng
View Code
[bzoj4591] [Shoi2015] super-capable particle cannon/change