{"id":71,"date":"2025-04-26T02:08:31","date_gmt":"2025-04-25T18:08:31","guid":{"rendered":"https:\/\/ceshiy.icu\/?p=71"},"modified":"2025-04-26T02:08:31","modified_gmt":"2025-04-25T18:08:31","slug":"math2","status":"publish","type":"post","link":"https:\/\/blog.ceshiy.fun\/index.php\/2025\/04\/26\/math2\/","title":{"rendered":"math2"},"content":{"rendered":"<h1>\u540c\u4f59\u65b9\u7a0b<\/h1>\n<p>$a \\equiv b (\\mod c)$ -&gt; $(a &#8211; b) = t \\cdot c$<\/p>\n<p>\u6269\u5c55\u6b27\u51e0\u91cc\u5f97\u6c42\u9006\u5143<\/p>\n<h1>\u8d39\u9a6c\u5c0f\u5b9a\u7406\u6c42\u9006\u5143<\/h1>\n<p>\u5feb\u901f\u5e42<\/p>\n<pre><code class=\"lang-c++ language-c++ c++\">ll fastPow(ll a, ll b) {\n    ll ret = 1;\n    while(b) {\n        if(b &amp; 1) ret = ret * a % MOD;\n        a = a * a % MOD;\n        b &gt;&gt;= 1;\n    }\n    return ret;\n}<\/code><\/pre>\n<p><a href=\"https:\/\/www.luogu.com.cn\/problem\/P3811\">P3811 \u3010\u6a21\u677f\u3011\u6a21\u610f\u4e49\u4e0b\u7684\u4e58\u6cd5\u9006\u5143 &#8211; \u6d1b\u8c37<\/a><\/p>\n<h1>\u7ec4\u5408\u6570\u5b66<\/h1>\n<h2>\u6c42\u7ec4\u5408\u6570<\/h2>\n<p><a href=\"https:\/\/www.luogu.com.cn\/problem\/U51417\">U51417 \u3010\u6a21\u677f\u3011\u6c42\u7ec4\u5408\u6570 &#8211; \u6d1b\u8c37<\/a><\/p>\n<pre><code class=\"lang-c++ language-c++ c++\">#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\ntypedef long long ll;\nconst ll MAXN = 3e7 + 5;\nll Tex, jc[MAXN], inv_jc[MAXN], n, MOD;\n\nvoid exgcd(ll a, ll b, ll &amp;x, ll &amp;y) {\n    if(b == 0) {\n        x = 1, y = 0;\n        return;\n    }\n    exgcd(b, a % b, x, y);\n    ll tmp = x;\n    x = y;\n    y = tmp - (a \/ b) * x;\n}\n\nll fastPow(ll a, ll b) {\n    ll ret = 1;\n    while(b) {\n        if(b &amp; 1) ret = ret * a % MOD;\n        a = a * a % MOD;\n        b &gt;&gt;= 1;\n    }\n    return ret;\n}\n\nvoid AC() {\n    ll m, n;\n    cin &gt;&gt; m &gt;&gt; n;\n    cout &lt;&lt; jc[m] * inv_jc[n] % MOD * inv_jc[m - n] % MOD &lt;&lt; &quot;\\n&quot;;\n}\n\nint main() {\n    MOD = 1e9 + 7;\n    n = MAXN - 5;\n    jc[0] = inv_jc[0] = 1;\n    for(int i = 1; i &lt;= n; i ++) {\n        jc[i] = jc[i - 1] * i % MOD;\n    }\n    inv_jc[n] = fastPow(jc[n], MOD - 2);\n    for(int i = n - 1; i &gt;= 1; i --) {\n        inv_jc[i] = inv_jc[i + 1] * (i + 1) % MOD;\n    }\n    cin &gt;&gt; Tex;\n    while(Tex --) AC();\n    return 0;\n}<\/code><\/pre>\n<h1>\u7ebf\u6027\u4ee3\u6570<\/h1>\n<h2>\u77e9\u9635\u5feb\u901f\u5e42<\/h2>","protected":false},"excerpt":{"rendered":"<p>\u540c\u4f59\u65b9\u7a0b $a \\equiv b (\\mod c)$ -&gt; $(a &#8211; b) = t \\cd [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-71","post","type-post","status-publish","format-standard","hentry","category-daily"],"_links":{"self":[{"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/posts\/71","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/comments?post=71"}],"version-history":[{"count":2,"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/posts\/71\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/posts\/71\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/media?parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/categories?post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ceshiy.fun\/index.php\/wp-json\/wp\/v2\/tags?post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}