{"id":210,"date":"2024-04-26T20:23:46","date_gmt":"2024-04-26T12:23:46","guid":{"rendered":"https:\/\/seanxd.com\/?p=210"},"modified":"2024-04-26T20:23:48","modified_gmt":"2024-04-26T12:23:48","slug":"zerojudge-m283","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-m283\/","title":{"rendered":"ZeroJudge M283: \u879e\u87fb\u7684\u64f4\u6563"},"content":{"rendered":"\n\n\n<p class=\"\">\u5ea7\u6a19\u5e73\u9762\u4e0a\uff0c\u7576\u879e\u87fb\u5728 (a, b) \u6642\uff0c\u4ed6\u53ef\u96a8\u6a5f\u79fb\u52d5\u5230\u9ede (a-1, b)\u3001(a, b-1)\u3001\u6216 (a-1, b-1) \u4e4b\u4e2d\u7684\u4e00\u9ede\uff0c\u4e14\u79fb\u52d5\u5230\u4e0a\u8ff0\u4efb\u4e00\u9ede\u7684\u6a5f\u7387\u5747\u70ba 1\/3\uff0c\u63a5\u4e0b\u4f86\u6bcf\u6b21\u79fb\u52d5\u90fd\u8207\u524d\u6b21\u79fb\u52d5\u7121\u95dc\u3002\u73fe\u5728\u6709\u4e00\u96bb\u879e\u87fb\u5f9e (x, y) \u958b\u59cb\u79fb\u52d5\uff0c\u76f4\u5230\u4ed6\u7b2c\u4e00\u6b21\u9047\u5230\u4efb\u610f\u5ea7\u6a19\u8ef8\u5373\u505c\u6b62\u79fb\u52d5\uff0c\u8acb\u554f\u6b64\u879e\u87fb\u6700\u5f8c\u4e00\u6b21\u505c\u6b62\u7684\u9ede\u4e0d\u662f\u5728\u539f\u9ede (0, 0) \u6a5f\u7387\u70ba\u4f55\uff1f<\/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\u8cc7\u8f38\u5165\u5169\u6b63\u6574\u6578 x \u548c y<br>(x, y &lt;= 10)<\/td><td>\u7b54\u6848\u4ee5<strong>\u6700\u7c21\u5206\u6578<\/strong>\u8868\u793a\uff0c\u8f38\u51fa\u300c\u5206\u5b50\/\u5206\u6bcd\u300d<\/td><\/tr><tr><td>3  3<br>2  2<br>1  1<\/td><td>70\/81<br>22\/27<br>2\/3<\/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=\"\">\u56e0\u70ba\u4f7f\u7528\u5206\u6578\u8f03\u96e3\u904b\u7b97\uff0c\u6240\u4ee5\u53ef\u4ee5<strong>\u5c07\u539f\u9ede\u7684\u6a5f\u7387 (\u4e5f\u5c31\u662f100%\u62161) \u4e58\u4ee5 3 \u7684 a + b \u6b21\u65b9<\/strong>\u3002\u53ef\u4ee5<strong>\u4f7f\u7528\u4e8c\u7dad\u9663\u5217\u4f86\u5b58\u6bcf\u500b\u9ede\u7684\u79fb\u52d5\u6a5f\u7387<\/strong>\uff0c\u4f7f\u7528 <strong>\u96d9For\u8ff4\u5708<\/strong> \u5c07\u6bcf\u500b\u9ede\u90fd\u8d70\u904e\u4e00\u904d\u3002\u7b54\u6848\u7684\u5206\u5b50\u5c31\u662f\u539f\u672c\u7684\u9ede = (0, 0) \u7684\u6a5f\u7387\uff0c\u5206\u6bcd\u5c31\u662f\u539f\u4f86\u7684\u9ede\u7684\u6a5f\u7387\u3002\u6700\u5f8c\u5c07\u5206\u6578\u7d04\u5206\u5230\u6700\u7c21\u5206\u6578\u518d\u8f38\u51fa\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=m283\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge M283: \u879e\u87fb\u7684\u64f4\u6563<\/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;math.h&gt;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int x, y;\n    while (cin &gt;&gt; x &gt;&gt; y)\n    {\n        long long int arr[20][20] = {0};\n        long long int og = pow(3, x+y);\n        arr[y][x] = og;\n        for (int yy = y; yy&gt;0; yy--)\n        {\n            for (int xx = x; xx&gt;0; xx--)\n            {\n                long long int tmp = arr[yy][xx] \/ 3;\n                arr[yy-1][xx] += tmp;\n                arr[yy][xx-1] += tmp;\n                arr[yy-1][xx-1] += tmp;\n            }\n        }\n        long long int up = og - arr[0][0];\n        long long int down = og;\n        bool stop = false;\n        while (!stop)\n        {\n            stop = true;\n            for (long long int i = 2; i&lt;=sqrt(up)+1; i++)\n            {\n                if (up % i == 0 && down % i == 0)\n                {\n                    up \/= i;\n                    down \/= i;\n                    stop = false;\n                }\n            }\n        }\n        cout &lt;&lt; up &lt;&lt; &quot;\/&quot; &lt;&lt; down &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge M283\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5ea7\u6a19\u5e73\u9762\u4e0a\uff0c\u7576\u879e\u87fb\u5728 (a, b) \u6642\uff0c\u4ed6\u53ef\u96a8\u6a5f\u79fb\u52d5\u5230\u9ede (a-1, b)\u3001(a, b-1)\u3001\u6216 (a-1,  [&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":[6],"tags":[15,22,13,9],"class_list":["post-210","post","type-post","status-publish","format-standard","hentry","category-6","tag-long-long-int","tag-22","tag-13","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/comments?post=210"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/210\/revisions"}],"predecessor-version":[{"id":211,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/210\/revisions\/211"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}