How Many Sets II Time Limit: 2 Seconds Memory Limit: 65536 KB Given a set S = {1, 2, ..., n}, number m and p, your job is to count how many set T satisfies the following condition: T is a subset of S |T| = m T does not contain continuous numbers…
题目大意:发上来就过不了审核了--总之大意就是求C(n,m) mod 10007 m,n∈[1,2*10^8] 卢卡斯定理:C(n,m)=C(n%p,m%p)*C(n/p,m/p) mod p 要求p是质数 当中n%p可能会小于m%p 这样的情况下直接返回0就可以 证明去问卢卡斯 我不知道 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define p 1…
lucas定理裸题. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define maxn 20050 #define mod 10007 using namespace std; long long t,n,m,inv1[maxn],inv2[maxn]; long long f_pow(long long x,long long y) { ,base=…