{"id":177,"date":"2023-05-11T20:46:49","date_gmt":"2023-05-11T12:46:49","guid":{"rendered":"https:\/\/solost.cn\/?p=177"},"modified":"2023-05-11T20:46:49","modified_gmt":"2023-05-11T12:46:49","slug":"289","status":"publish","type":"post","link":"https:\/\/solost.cn\/?p=177","title":{"rendered":"Codeforces Round 871 (Div. 4) &#8211; G. Hits Different"},"content":{"rendered":"<h2>\u9898\u76ee\u94fe\u63a5<\/h2>\n<p><a href=\"https:\/\/codeforces.com\/contest\/1829\/problem\/G\">\u9898\u76ee\u94fe\u63a5<\/a><\/p>\n<h2>\u9898\u76ee\u5927\u610f<\/h2>\n<p>\u7ed9\u4f60\u4e00\u4e2a2023\u884c\u7684\u6768\u8f89\u4e09\u89d2\uff0c\u7136\u540e\u6309\u7167\u4ece\u5de6\u5230\u53f3\u4ece\u4e0a\u5230\u4e0b\u7684\u987a\u5e8f\u6807\u53f7\uff0c\u6bcf\u4e2a\u5e8f\u53f7\u7684\u65b9\u5757\u503c\u7b49\u4e8e\u81ea\u5df1\u5e8f\u53f7\u7684\u5e73\u65b9\uff0c\u95ee\u4f60\u6253\u6389\u67d0\u4e2a\u5e8f\u53f7\u7684\u65b9\u5757\uff0c\u6240\u6709\u6389\u843d\u65b9\u5757\u7684\u503c\u7684\u548c\u662f\u591a\u5c11\uff1f\u6253\u6389\u4e00\u4e2a\u65b9\u5757\uff0c\u8be5\u65b9\u5757\u8fde\u63a5\u7684\u4e5f\u4f1a\u6389\uff08\u4e0a\u4e00\u5c42\uff09\u6253\u63899\u4f1a\u63895\uff0c6\u3002<\/p>\n<h2>\u9898\u89e3<\/h2>\n<p>\u5927\u6982\u5c31\u662f2023*2023\/2\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u3002\u9996\u5148\u6309\u7167\u6768\u8f89\u4e09\u89d2\u7684\u6837\u5b50\u751f\u6210\u6768\u8f89\u4e09\u89d2\uff0c\u5e76\u7b97\u51fa\u6bcf\u4e2a\u65b9\u5757\u7684\u503c\u3002\u9996\u5148\u6253\u6389\u4f8b\u5982\u8bf49\u8fd9\u4e2a\u65b9\u5757\u6389\u7684\u503c\u4e0d\u662f5\u6240\u6709\u6389\u7684\u548c6\u6240\u6709\u6389\u843d\u7684\uff0c\u90a3\u662f\u56e0\u4e3a5\u548c6\u6709\u91cd\u590d\u7684\u5730\u65b9\uff0c\u6240\u4ee5\u4e0d\u80fd\u76f4\u63a5\u90a3\u4e48\u8ba1\u7b97\uff0c\u901a\u8fc7\u89c2\u5bdf\u627e\u89c4\u5f8b\u53d1\u73b0\uff0c\u6bcf\u4e2a\u65b9\u5757\u6253\u6389\u4e00\u5171\u6389\u843d\u7684\u6570\u76ee\u662f\u8be5\u5217\u659c\u5bf9\u89d2\u7ebf\u7684\u6240\u6709\u5757\u3002\u7136\u540e\u4f7f\u7528\u524d\u7f00\u548c\u8ba1\u7b97\u5373\u53ef\u3002\u4f8b\u5982\u8bf4\u62538\u5427\uff0c\u7b2c\u4e00\u4e2a\u659c\u5bf9\u89d2\u5c31\u662f4\uff0c8\u524d\u4e00\u884c\u662f2\uff0c5\u518d\u524d\u4e00\u884c\u5c31\u662f1\uff0c3\u3002\u6240\u4ee5\u6bcf\u4e2a\u65b9\u5757\u6389\u843d\u503c\u5c31\u662f\u659c\u5bf9\u89d2\u7ebf\u6240\u6709\u7684\u548c\u3002<\/p>\n<h2>\u4ee3\u7801<\/h2>\n<pre><code class=\"lang-cpp\">#include &lt;algorithm&gt;\n#include &lt;bitset&gt;\n#include &lt;cmath&gt;\n#include &lt;cstdio&gt;\n#include &lt;cstdlib&gt;\n#include &lt;cstring&gt;\n#include &lt;fstream&gt;\n#include &lt;iostream&gt;\n#include &lt;map&gt;\n#include &lt;queue&gt;\n#include &lt;set&gt;\n#include &lt;stack&gt;\n#include &lt;unordered_map&gt;\n#include &lt;unordered_set&gt;\n#include &lt;vector&gt;\n\n#define x first\n#define y second\n#define endl &#039;\\n&#039;\n#define IOS                       \\\n    ios_base::sync_with_stdio(0); \\\n    cin.tie(0);                   \\\n    cout.tie(0);\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair&lt;ll, ll&gt; pll;\ntypedef pair&lt;int, int&gt; pii;\ntypedef unsigned long long ull;\n\nconst int INF = 0x3f3f3f3f, mod = 1000000007;\nconst int N = 2040;\n\nll a[N][N], b[N][N], d[N][N];\nmap&lt;ll, pll&gt; q;\n\nvoid solve()\n{\n    ll cnt = 1, c = 1;\n    for (int i = 1; i &lt;= 2023; i++) {\n        int j = 1;\n        while (j &lt;= i) {\n            a[i][j] = cnt * cnt;\n            q[cnt] = { i, j };\n            cnt++;\n            j++;\n        }\n    }\n    d[1][1] = a[1][1];\n    for(int i = 2; i &lt;= 2023; i++){\n        for(int j = 1; j &lt;= i; j++){\n            d[i][j] = d[i - 1][j - 1] + a[i][j];\/\/\u8ba1\u7b97\u6bcf\u4e2a\u65b9\u5757\u659c\u5bf9\u89d2\u7ebf\u7684\u65b9\u5757\u503c\u7684\u548c\n        }\n    }\n    \/\/ cout &lt;&lt; &quot;--------------------\\n&quot;;\n    for(int i = 1; i &lt;= 2023; i++){\n        for(int j = 1; j &lt;= i; j++){\n            d[i][j] += d[i - 1][j];\/\/\u7136\u540e\u6c42\u5f53\u524d\u659c\u5bf9\u89d2\u7ebf\u4e0a\u9762\u7684\u6240\u6709\u7684\u548c\n        }\n    }\n}\nint main()\n{\n    IOS;\n    int t = 1;\n    solve();\n    cin &gt;&gt; t;\n    while (t--) {\n        int x;\n        cin &gt;&gt; x;\n        cout &lt;&lt; d[q[x].x][q[x].y] &lt;&lt; endl;\n    }\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9898\u76ee\u94fe\u63a5 \u9898\u76ee\u94fe\u63a5 \u9898\u76ee\u5927\u610f \u7ed9\u4f60\u4e00\u4e2a2023\u884c\u7684\u6768\u8f89\u4e09\u89d2\uff0c\u7136\u540e\u6309\u7167\u4ece\u5de6\u5230\u53f3\u4ece\u4e0a\u5230\u4e0b\u7684\u987a\u5e8f\u6807\u53f7\uff0c\u6bcf\u4e2a\u5e8f\u53f7\u7684\u65b9\u5757\u503c\u7b49\u4e8e\u81ea\u5df1\u5e8f\u53f7\u7684\u5e73\u65b9\uff0c\u95ee\u4f60\u6253\u6389\u67d0\u4e2a\u5e8f\u53f7\u7684\u65b9\u5757\uff0c\u6240\u6709\u6389\u843d\u65b9\u5757\u7684\u503c\u7684\u548c\u662f\u591a\u5c11\uff1f\u6253\u6389\u4e00\u4e2a\u65b9\u5757\uff0c\u8be5\u65b9\u5757\u8fde\u63a5\u7684\u4e5f\u4f1a\u6389\uff08\u4e0a\u4e00\u5c42\uff09\u6253\u63899\u4f1a\u63895\uff0c6\u3002 \u9898\u89e3 \u5927\u6982\u5c31\u662f2023*2023\/2\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u3002\u9996\u5148\u6309\u7167\u6768\u8f89\u4e09\u89d2\u7684\u6837\u5b50\u751f\u6210\u6768\u8f89\u4e09\u89d2\uff0c\u5e76\u7b97\u51fa\u6bcf\u4e2a\u65b9\u5757\u7684\u503c\u3002\u9996\u5148\u6253\u6389\u4f8b\u5982\u8bf49\u8fd9\u4e2a\u65b9\u5757\u6389\u7684\u503c\u4e0d\u662f5\u6240\u6709\u6389\u7684\u548c6\u6240\u6709\u6389\u843d\u7684\uff0c\u90a3\u662f\u56e0\u4e3a5\u548c6\u6709\u91cd\u590d\u7684\u5730\u65b9\uff0c\u6240\u4ee5\u4e0d\u80fd\u76f4\u63a5\u90a3\u4e48\u8ba1\u7b97\uff0c\u901a\u8fc7\u89c2\u5bdf\u627e\u89c4\u5f8b\u53d1\u73b0\uff0c\u6bcf\u4e2a\u65b9\u5757\u6253\u6389\u4e00\u5171\u6389\u843d\u7684\u6570\u76ee\u662f\u8be5\u5217\u659c\u5bf9\u89d2\u7ebf\u7684\u6240\u6709\u5757\u3002\u7136\u540e\u4f7f\u7528\u524d\u7f00\u548c\u8ba1\u7b97\u5373\u53ef\u3002\u4f8b\u5982\u8bf4\u62538\u5427\uff0c\u7b2c\u4e00\u4e2a\u659c\u5bf9\u89d2\u5c31\u662f4\uff0c8\u524d\u4e00\u884c\u662f2\uff0c5\u518d\u524d\u4e00\u884c\u5c31\u662f1\uff0c3\u3002\u6240\u4ee5\u6bcf\u4e2a\u65b9\u5757\u6389\u843d\u503c\u5c31\u662f\u659c\u5bf9\u89d2\u7ebf\u6240\u6709\u7684\u548c\u3002 \u4ee3\u7801 #include &lt;algorithm&gt; #include &lt;bitset&gt; #include &lt;cmath&gt; #include &lt;cstdio&gt; #include &lt;cstdlib&gt; #include &lt;cstring&gt; #include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;map&gt; #include &lt;queue&gt; #include &lt;set&gt; #include &lt;stack&gt; #include &lt;unordered_map&gt; #include &lt;unordered_set&gt; #include &lt;vector&gt; #define x first #define y second #define endl &#039;\\n&#039; #define IOS \\ ios_base::sync_with_stdio(0); \\ cin.tie(0); \\ cout.tie(0); using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[11],"class_list":["post-177","post","type-post","status-publish","format-standard","hentry","category-solution","tag-11"],"_links":{"self":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=177"}],"version-history":[{"count":0,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/177\/revisions"}],"wp:attachment":[{"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}