{"id":307,"date":"2024-04-27T17:59:33","date_gmt":"2024-04-27T09:59:33","guid":{"rendered":"https:\/\/seanxd.com\/?p=307"},"modified":"2024-04-27T17:59:35","modified_gmt":"2024-04-27T09:59:35","slug":"zerojudge-d123","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-d123\/","title":{"rendered":"ZeroJudge D123: B2-Sequence"},"content":{"rendered":"\n\n\n<h4 class=\"wp-block-heading\">\u540c\u984c\uff1aUVa 11063 &#8211; B2-Sequence<\/h4>\n\n\n\n<p class=\"\">\u6240\u8b02\u300cB2 \u6578\u5217\u300d\u4fc2\u6307\u4e00\u6b63\u6574\u6578\u6578\u5217 1 &lt;= B1 &lt; B2 &lt; B3 \u2026\uff0c\u5176\u4e2d\u6240\u6709\u7684 B<sub>i<\/sub> + B<sub>j<\/sub>  (i &lt;= j) \u7686\u4e0d\u76f8\u7b49\u3002<\/p>\n\n\n\n<p class=\"\">\u60a8\u7684\u4efb\u52d9\u662f<strong>\u5224\u5225\u67d0\u4e00\u6578\u5217\u662f\u5426\u70ba\u300cB2 \u6578\u5217\u300d<\/strong>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7bc4\u4f8b\u6e2c\u8cc7<\/h2>\n\n\n\n<figure class=\"wp-block-table nfd-wb-animate nfd-wb-fade-in-bottom-short\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7bc4\u4f8b\u8f38\u5165<\/th><th>\u7bc4\u4f8b\u8f38\u51fa<\/th><\/tr><\/thead><tbody><tr><td><strong>EOF<\/strong> \u8f38\u5165\uff0c\u6bcf\u7b46\u6e2c\u8a66\u8cc7\u6599\u6709\u5169\u884c\uff0c\u7b2c\u4e00\u884c\u4ee3\u8868\u8a72\u6578\u5217\u6709 N \u500b\u6578\u503c\uff082 \u2264 N \u2264 100\uff09\uff0c\u7b2c\u4e8c\u884c\u5247\u70ba\u8a72\u6578\u5217\u7684 N \u500b\u6578\u503c\u3002\u6bcf\u500b\u6578\u503c B<sub>i<\/sub> \u7686\u70ba\u6574\u6578\uff0c\u4e14 B<sub>i<\/sub> \u2264 10000\u3002<\/td><td>\u6bcf\u7b46\u6e2c\u8a66\u8cc7\u6599\u4ee5\u4e00\u884c\u8f38\u51fa\uff0c\u4e14\u6bcf\u7b46\u8f38\u51fa\u8cc7\u6599\u5f8c\u5747\u9700\u8f38\u51fa\u4e00\u7a7a\u767d\u884c\u3002<\/td><\/tr><tr><td>4<br>1  2  4  8<br>4<br>3  7  10  14<br>5<br>13  14  15  16  17<\/td><td>Case #1: It is a B2-Sequence.<br><br>Case #2: It is not a B2-Sequence.<br><br>Case #3: It is not a B2-Sequence.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p class=\"\">\u4f7f\u7528<strong>\u5169\u500b For\u8ff4\u5708 \u5c07\u6240\u6709\u7d44\u5408\u7684\u4efb\u610f\u5169\u6578\u76f8\u52a0<\/strong>\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\u300c\u7b2c\u4e8c\u500b\u88e1\u9762\u7684\u8ff4\u5708 j \u8981\u7b49\u65bc i\u300d\uff0c\u8981<strong>\u907f\u514d\u5f80\u56de\u52a0\u7684\u60c5\u6cc1<\/strong>\u3002\u8209\u4f8b1+2\u7b49\u65bc2+1\uff0c\u56e0\u70ba\u8981\u7528Map\u4f86\u78ba\u8a8d\u4efb\u610f\u5169\u6578\u7684\u548c\u51fa\u73fe\u904e\u5e7e\u6b21\uff0c\u4e14\u9019\u6a23\u5b50\u5176\u5be6\u53ea\u6709\u7b97\u4e00\u6b21\u7684\u60c5\u6cc1\uff0c\u6240\u4ee5\u4e0d\u80fd\u5f80\u56de\u52a0\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c\u6709\u4efb\u610f\u5169\u6578\u7684\u548c\u5df2\u7d93\u51fa\u73fe\u904e\u7684\u60c5\u6cc1\uff0c\u53ef\u4ee5\u76f4\u63a5Break\u8ff4\u5708\u4e26\u8f38\u51fa\u7b54\u6848\u3002<\/p>\n\n\n\n<p class=\"\">Case\u7684\u90e8\u5206\u53ef\u4ee5\u5728EOF\u5916\u9762\u5ba3\u544a\u4e00\u500b\u8b8a\u6578\u6bcf\u6b21\u9032\u4f86While\u8ff4\u5708\u505a+1\u5373\u53ef\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=d123\" target=\"_blank\" rel=\"noopener\">ZeroJudge D123: B2-Sequence<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap nfd-wb-animate nfd-wb-reveal-right nfd-delay-50\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\"><code>#include &lt;iostream&gt;\n#include &lt;vector&gt;\n#include &lt;map&gt;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int N, count = 1;\n    while (cin &gt;&gt; N)\n    {\n        vector&lt;int&gt;num;\n        map&lt;int, int&gt;MAP;\n        for (int i = 0; i&lt;N; i++)\n        {\n            int tmp;\n            cin &gt;&gt; tmp;\n            num.push_back(tmp);\n        }\n        bool stop = false;\n        for (int i = 0; i&lt;N; i++)\n        {\n            for (int j = i; j&lt;N; j++)\n            {\n                if (MAP[num[i]+num[j]] != 0)\n                {\n                    stop = true;\n                    break;\n                }\n                MAP[num[i]+num[j]]++;\n            }\n            if (stop) break;\n        }\n        if (stop) cout &lt;&lt; &quot;Case #&quot; &lt;&lt; count &lt;&lt; &quot;: It is not a B2-Sequence.\\n&quot;;\n        else cout &lt;&lt; &quot;Case #&quot; &lt;&lt; count &lt;&lt; &quot;: It is a B2-Sequence.\\n&quot;;\n        count++;\n    }\n}\n\n\/\/ZeroJudge D123\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 11063 &#8211; B2-Sequence \u6240\u8b02\u300cB2 \u6578\u5217\u300d\u4fc2\u6307\u4e00\u6b63\u6574\u6578\u6578\u5217 1 &#038;l [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[18],"tags":[14,20,8,13,9],"class_list":["post-307","post","type-post","status-publish","format-standard","hentry","category-uva","tag-map","tag-20","tag-8","tag-13","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/comments?post=307"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/307\/revisions"}],"predecessor-version":[{"id":308,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/307\/revisions\/308"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}