摘要: /**中国剩余定理(不互质)*/#include #include #include using namespace std;typedef __int64 int64;int64 Mod;int64 gcd(int64 a, int64 b){ if(b==0) return a; return gcd(b,a%b);}int64 Extend_Euclid(int64 a, int64 b, int64&x, int64& y){ if(b==0) { x=1,y=0; return a; } int64 d = Extend_Euclid(b,a%b,x,y); int6 阅读全文
posted @ 2014-04-26 19:36 _一千零一夜 阅读(628) 评论(0) 推荐(0) 编辑
摘要: 一下午 终于行了基本的容斥定理收藏 2314291容斥原理编辑在计数时,必须注意无一重复,无一遗漏。为了使重叠部分不被重复计算,人们研究出一种新的计数方法,这种方法的基本思想是:先不考虑重叠的情况,把包含于某内容中的所有对象的数目先计算出来,然后再把计数时重复计算的数目排斥出去,使得计算的结果既无遗漏又无重复,这种计数的方法称为容斥原理。目录1公式2严格证明3原理1▪ 分析 ▪ 答案 ▪ 试一试 4原理2▪ 例1 ▪ 例2 ▪ 例3 ▪ 例4 ▪ 例5 1公式编辑也可表示为设S为有限集,,则#includeint a[12];__int64 n;__int64 sum;int m;__int6 阅读全文
posted @ 2014-04-26 19:10 _一千零一夜 阅读(85) 评论(0) 推荐(0) 编辑