题面戳我 Solution 板子题 Code //It is coded by ning_mew on 7.25 #include<bits/stdc++.h> #define LL long long using namespace std; const LL MOD=10007; int T; LL A[MOD],B[MOD],n,m; void pre(){ A[0]=B[0]=A[1]=B[1]=1; for(int i=2;i<MOD;i++)B[i]=-(MOD/i)*B[M…
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…
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…
题目大意:发上来就过不了审核了--总之大意就是求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…
acm.hdu.edu.cn/showproblem.php?pid=3037 [题意] m个松果,n棵树 求把最多m个松果分配到最多n棵树的方案数 方案数有可能很大,模素数p 1 <= n, m <= 1000000000, 1 < p < 100000 [思路] 答案为C(n+m,m)%p 对于C(n, m) mod p.这里的n,m,p(p为素数)都很大的情况.就不能再用C(n, m) = C(n - 1,m) + C(n - 1, m - 1)的公式递推了.这里用到Luca…
J. Ceizenpok’s formula time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dr. Ceizenp'ok from planet i1c5l became famous across the whole Universe thanks to his recent discovery — the Ceizenp…
$补+写题ing$ 第 1 章 快速幂 序列的第 k 个数 link $solution:$ 板子 A 的 B 次方 link $solution:$ 板子 [NOIP2013] 转圈游戏 link $solution:$ 板子 越狱 link $solution:$ 简单的容斥原理,$m^n-m\times \prod_{i=1}^{n-1} m-1$ 第 2 章 质数 Prime Distance link $solution:$ 先筛掉$[1,\sqrt{R}]$,然后在暴力即可. 质因数…
题意:求C(n,m) n,m<=200000000 思路:c(n,m)=c(n mod mo,m mod mo)*c(n div mo,m div mo) mod mo (n>=mo或m>=mo) c(x,y)=0 (x<y) c(n,m)=fac[n]*exf[m]*exf[n-m] (n,m<mo) ; ..]of longint; n,i,x,y:longint; function c(n,m:longint):longint; begin ); if (n<mo…