草庐IT

主定理

全部标签

容斥定理 AtCoder——FizzBuzz Sum Hard

题目传送门ProblemStatementFindthesumofintegersbetween 1 and N(inclusive)thatarenotmultiplesof Aor B.Constraints1≤N,A,B≤109 Allvaluesininputareintegers.InputInputisgivenfromStandardInputinthefollowingformat:NABOutputPrinttheanswer.Sample1InputcopyOutputcopy103522Theintegersbetween 1 and 10(inclusive)thata

容斥定理 AtCoder——FizzBuzz Sum Hard

题目传送门ProblemStatementFindthesumofintegersbetween 1 and N(inclusive)thatarenotmultiplesof Aor B.Constraints1≤N,A,B≤109 Allvaluesininputareintegers.InputInputisgivenfromStandardInputinthefollowingformat:NABOutputPrinttheanswer.Sample1InputcopyOutputcopy103522Theintegersbetween 1 and 10(inclusive)thata

【数论与组合数学 2】同余、中国剩余定理

同余、中国剩余定理一、同余(Congruence)1.令\(\mathsf{a,\b,\m}\)为整数,且$\mathsf{m\neq0}$。当满足\(\mathsf{m\mid(a-b)}\)时,称a与b模m同余,写作\(\mathsf{a\equivb\mod\m}\)例子:\(\mathsf{3\equiv27\mod\12}\),\(\mathsf{-3\equiv11\mod\7}\)2.基本性质:同余兼容常用加法与乘法运算。如果\(\mathsf{a\equivb\(mod\m)}\)并且\(\mathsf{c\equivd\(mod\m)}\),那么\(\mathsf{a+c\e

【数论与组合数学 2】同余、中国剩余定理

同余、中国剩余定理一、同余(Congruence)1.令\(\mathsf{a,\b,\m}\)为整数,且$\mathsf{m\neq0}$。当满足\(\mathsf{m\mid(a-b)}\)时,称a与b模m同余,写作\(\mathsf{a\equivb\mod\m}\)例子:\(\mathsf{3\equiv27\mod\12}\),\(\mathsf{-3\equiv11\mod\7}\)2.基本性质:同余兼容常用加法与乘法运算。如果\(\mathsf{a\equivb\(mod\m)}\)并且\(\mathsf{c\equivd\(mod\m)}\),那么\(\mathsf{a+c\e