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=…
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2982 [算法] lucas定理 [代码] #include<bits/stdc++.h> using namespace std; ; int n,m,T; int fac[P],inv[P]; inline int power(int a,int n) { ; while (n) { ) res = 1ll * res * b % P; b = 1ll * b * b % P;…
J. Ceizenpok’s formula time limit per test 2.0 s memory limit per test 256 MB input standard input output standard output Dr. Ceizenp'ok from planet i1c5l became famous across the whole Universe thanks to his recent discovery — the Ceizenpok’s formul…