{"id":293,"date":"2019-09-27T11:03:16","date_gmt":"2019-09-27T03:03:16","guid":{"rendered":"http:\/\/www.guanhaobo.cn\/?p=293"},"modified":"2019-09-27T11:03:16","modified_gmt":"2019-09-27T03:03:16","slug":"vijos-1004-%e4%bc%8a%e7%94%b8%e5%9b%ad%e6%97%a5%e5%8e%86%e6%b8%b8%e6%88%8f","status":"publish","type":"post","link":"https:\/\/www.guanhaobo.cn\/?p=293","title":{"rendered":"Vijos 1004 \u2014 \u4f0a\u7538\u56ed\u65e5\u5386\u6e38\u620f"},"content":{"rendered":"<h3>\u63cf\u8ff0<\/h3>\n<p>Adam\u548cEve\u73a9\u4e00\u4e2a\u6e38\u620f\uff0c\u4ed6\u4eec\u5148\u4ece1900.1.1\u52302001.11.4\u8fd9\u4e2a\u65e5\u671f\u4e4b\u95f4\u968f\u610f\u62bd\u53d6\u4e00\u4e2a\u65e5\u671f\u51fa\u6765\u3002\u7136\u540e\u4ed6\u4eec\u8f6e\u6d41\u5bf9\u8fd9\u4e2a\u65e5\u671f\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<p>1 \uff1a \u628a\u65e5\u671f\u7684\u5929\u6570\u52a01\uff0c\u4f8b\u59821900.1.1\u53d8\u52301900.1.2<br \/>\n2 \uff1a \u628a\u6708\u4efd\u52a01\uff0c\u4f8b\u5982\uff1a1900.1.1\u53d8\u52301900.2.1<\/p>\n<p>\u5176\u4e2d\u5982\u679c\u5929\u6570\u8d85\u8fc7\u5e94\u6709\u5929\u6570\u5219\u65e5\u671f\u53d8\u66f4\u5230\u4e0b\u4e2a\u6708\u7684\u7b2c1\u5929\u3002\u6708\u4efd\u8d85\u8fc712\u5219\u53d8\u5230\u4e0b\u4e00\u5e74\u76841\u6708\u3002\u800c\u4e14\u8fdb\u884c\u64cd\u4f5c\u4e8c\u7684\u65f6\u5019\uff0c\u5982\u679c\u6709\u8fd9\u6837\u7684\u65e5\u671f\uff1a1900.1.31\uff0c\u5219\u53d8\u6210\u4e861900.2.31\uff0c\u8fd9\u6837\u7684\u64cd\u4f5c\u662f\u975e\u6cd5\u7684\uff0c\u6211\u4eec\u4e0d\u5141\u8bb8\u8fd9\u6837\u505a\u3002\u800c\u4e14\u6240\u6709\u7684\u64cd\u4f5c\u5747\u8981\u8003\u8651\u5386\u6cd5\u548c\u95f0\u5e74\u7684\u89c4\u5b9a\u3002<\/p>\n<p>\u8c01\u5148\u5c06\u65e5\u671f\u53d8\u52302001.11.4\u8c01\u5c31\u8d62\u4e86\u3002<br \/>\n\u6bcf\u6b21\u6e38\u620f\u90fd\u662fAdam\u5148\u64cd\u4f5c\uff0c\u95ee\u4ed6\u6709\u6ca1\u6709\u5fc5\u80dc\u7b56\u7565\uff1f<\/p>\n<h3>\u9898\u76ee\u94fe\u63a5<\/h3>\n<p><a href=\"https:\/\/vijos.org\/p\/1004\" title=\"https:\/\/vijos.org\/p\/1004\">https:\/\/vijos.org\/p\/1004<\/a><\/p>\n<h3>\u8f93\u5165\u683c\u5f0f<\/h3>\n<p>\u4e00\u4e2a\u6d4b\u8bd5\u70b9\u3002\u591a\u7ec4\u6570\u636e\u3002<br \/>\n\u7b2c\u4e00\u884c\u4e3a\u6570\u636e\u7ec4\u6570\u3002<br \/>\n\u63a5\u4e0b\u6765\u4e00\u884cX Y Z\u8868\u793aX\u5e74Y\u6708Z\u65e5<\/p>\n<h3>\u8f93\u51fa\u683c\u5f0f<\/h3>\n<p>\u8f93\u51fa\u201cYES\u201dor\u201cNO\u201d\u8868\u793a\u4e9a\u5f53\u662f\u5426\u6709\u5fc5\u80dc\u7b56\u7565\u3002<\/p>\n<h3>\u6837\u4f8b\u8f93\u5165<\/h3>\n<pre><code class=\"language-cpp line-numbers\">3\n2001 11 3\n2001 11 2\n2001 10 3\n<\/code><\/pre>\n<h3>\u6837\u4f8b\u8f93\u51fa<\/h3>\n<pre><code class=\"language-cpp line-numbers\">YES\nNO\nNO\n<\/code><\/pre>\n<h3>\u63d0\u793a<\/h3>\n<p>\u5efa\u8bae\u5148\u628a\u6240\u6709\u60c5\u51b5\u90fd\u7b97\u51fa\u6765^_^<\/p>\n<h3>\u9898\u76ee\u5206\u6790<\/h3>\n<h5>\u52a8\u6001\u89c4\u5212\uff08\u8bb0\u5fc6\u5316\u641c\u7d22\uff09<\/h5>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u5c06\u67d0\u4e00\u5929\u5b58\u5728\u5fc5\u80dc\u7b56\u7565\u79f0\u4e3a\u8fd9\u4e00\u5929\u5fc5\u80dc\u3002<br \/>\n\u5bf9\u4e8e\u67d0\u4e00\u5929 X \uff0c\u4e0b\u4e00\u6b65\u6709\u4e24\u79cd\u60c5\u51b5\uff0c\u6708\u4efd\u52a0\u4e00\u6216\u8005\u65e5\u671f\u52a0\u4e00\u3002\u5982\u679c\u4e0b\u4e00\u6b65\u7684\u4e24\u79cd\u60c5\u51b5\u90fd\u662f\u5fc5\u80dc\u7684\uff0c\u90a3\u4e48 X \u4e0d\u5fc5\u80dc\uff0c\u56e0\u4e3a\u65e0\u8bba\u8f6c\u79fb\u5230\u54ea\u79cd\u60c5\u51b5\uff0c\u5bf9\u624b\u90fd\u662f\u6709\u5fc5\u80dc\u7684\u7b56\u7565\u7684\uff1b\u5982\u679c\u4e24\u79cd\u60c5\u51b5\u81f3\u5c11\u6709\u4e00\u79cd\u662f\u4e0d\u5fc5\u80dc\u7684\uff0c\u90a3\u4e48 X \u5fc5\u80dc\uff0c\u56e0\u4e3a\u53ef\u4ee5\u8f6c\u79fb\u5230\u4e0d\u5fc5\u80dc\u7684\u60c5\u51b5\uff0c\u8ba9\u5bf9\u624b\u5931\u8d25\u3002<br \/>\n\u5f53\u7136\uff0c\u5982\u679c\u6708\u4efd\u52a0\u4e00\u662f\u4e0d\u5408\u6cd5\u7684\uff0c\u4e0b\u4e00\u6b65\u5c31\u53ea\u80fd\u4ee4\u65e5\u671f\u52a0\u4e00\u3002\u8fd9\u65f6\uff0c\u5982\u679c\u65e5\u671f\u52a0\u4e00\u5fc5\u80dc\uff0c\u5219 X \u4e0d\u5fc5\u80dc\uff1b\u53cd\u4e4b\u5219 X \u5fc5\u80dc\u3002<br \/>\nX \u662f\u5426\u5fc5\u80dc\uff0c\u53d6\u51b3\u4e8e X+1 \u5929\u548c X+1 \u6708\u662f\u5426\u5fc5\u80dc\u3002<br \/>\n\u56e0\u6b64\uff0c\u53ea\u8981\u4ece 2001.11.4 \u5f80\u524d\u63a8\uff0c\u5c06\u6240\u6709\u65e5\u671f\u7684\u7b54\u6848\u90fd\u8ba1\u7b97\u51fa\u6765\u5373\u53ef\u3002\u4e34\u754c\u6761\u4ef6\u662f\uff1a2001.11.4 \u662f\u5fc5\u8d25\u7684\uff1b\u5927\u4e8e 2001.11.4 \u7684\u65e5\u671f\u90fd\u662f\u5fc5\u80dc\u7684\uff0c\u56e0\u4e3a\u8c01\u5148\u8f6c\u79fb\u5230\u8d85\u8fc7 2001.11.4 \u7684\u65e5\u671f\u8c01\u5c31\u5931\u8d25\uff0c\u76f8\u5f53\u4e8e\u8c01\u5f53\u524d\u662f\u5927\u4e8e 2001.11.4 \u7684\u65e5\u671f\uff0c\u8c01\u5c31\u5fc5\u80dc\u3002<\/p>\n<h5>\u627e\u89c4\u5f8b<\/h5>\n<p>\u8bbe\u5e74 x\uff0c\u6708 y\uff0c\u65e5 z<br \/>\n\u5f53 (y+z)%2 == 0 \u65f6\uff0c\u5fc5\u80dc\uff1b\u53cd\u4e4b\u5fc5\u8d25\u3002<br \/>\n\u7279\u6b8a\u60c5\u51b5\uff1a9\u670830\u65e5\u548c11\u670830\u65e5\uff0c\u5fc5\u80dc\u3002<br \/>\n\u5bf9\u4e8e\u8fd9\u4e2a\u89c4\u5f8b\uff0c\u7f51\u4e0a\u5f88\u591a\u5927\u725b\u8fdb\u884c\u4e86\u5206\u6790\u3002\u4e0d\u8fc7\u6211\u5e76\u6ca1\u770b\u61c2\u3002<br \/>\n\u6216\u8bb8\u662f\u6211\u592a\u83dc\u4e86\u3002<br \/>\n\u5f53\u7136\uff0c\u5148\u6309\u7167\u4e0a\u4e00\u79cd\u65b9\u6cd5\u8ba1\u7b97\u6240\u6709\u7b54\u6848\uff0c\u7136\u540e\u8f93\u51fa\uff0c\u4e5f\u80fd\u627e\u51fa\u8fd9\u4e2a\u89c4\u5f8b\u3002<br \/>\n\u9898\u76ee\u672c\u610f\u5e94\u8be5\u5c31\u662f\u8ba9\u8bb0\u5fc6\u5316\u641c\u7d22\u3002<\/p>\n<h3>AC\u4ee3\u78011<\/h3>\n<pre><code class=\"language-cpp line-numbers\">#include &lt;bits\/stdc++.h&gt;\nusing namespace std;\n\nint ans[3000][13][32] = {0};\nint num[] = {31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; \/\/\u6bcf\u6708\u7684\u5929\u6570\uff0c0\u6708\u4efd\u548c12\u6708\u4efd\u4e00\u6837\uff0c\u65b9\u4fbf\u7a0b\u5e8f\nint x2, y2, z2;\n\nvoid convert(int x, int y, int z) \/\/\u5c06xyz\u8f6c\u5316\u6210\u6b63\u5e38\u7684\u5e74\u6708\u65e5\u5e76\u4fdd\u5b58\u5728\u53d8\u91cfx2 y2 z2\u4e2d\n{\n    x2 = x, y2 = y, z2 = z;\n    if (z2 == 0) \/\/\u65e5\u671f\u51cf\u4e00\u7684\u60c5\u51b5\n    {\n        if (!(((x2 % 4 == 0 &amp;&amp; x2 % 100 != 0) || (x2 % 400 == 0)) &amp;&amp; y2 == 3 &amp;&amp; z2 == 0)) \/\/\u4e0d\u662f\u95f0\u5e743\u67080\u65e5\n        {\n            y2 = y2 - 1;\n            if (y2 == 0)\n            {\n                x2--;\n                y2 = 12;\n            }\n            z2 = num[y2];\n        }\n        else\n        {\n            y2 = 2;\n            z2 = 29;\n        }\n    }\n    if (!(((x2 % 4 == 0 &amp;&amp; x2 % 100 != 0) || (x2 % 400 == 0)) &amp;&amp; y2 == 2 &amp;&amp; z2 == 29)) \/\/\u4e0d\u662f\u95f0\u5e742\u670829\u65e5\n    {\n        if (z2 &gt; num[y2])\n        {\n            y2 = y2 + 1;\n            z2 = 1;\n        }\n    }\n    if (y2 == 13)\n    {\n        y2 = 1;\n        x2 = x2 + 1;\n    }\n}\n\nint f(int x, int y, int z) \/\/\u8fd4\u56de\u662f\u5426\u5fc5\u80dc\uff0c1\u4e3a\u5fc5\u80dc\uff0c-1\u4e3a\u4e0d\u5fc5\u80dc\n{\n    if (x &gt; 2001 || (x == 2001 &amp;&amp; y &gt; 11) || (x == 2001 &amp;&amp; y == 11 &amp;&amp; z &gt; 4)) \/\/\u8d85\u8fc7 2001.11.4 \u5219\u8fd4\u56de1\uff0c\u56e0\u4e3a\u8c01\u5148\u51fa\u754c\u8c01\u5c31\u8f93\n        return 1;\n    if (x == 2001 &amp;&amp; y == 11 &amp;&amp; z == 4)\n        return -1;\n\n    int t1, t2; \/\/\u4e24\u79cd\u8f6c\u6362\u7684\u7ed3\u679c\n\n    \/\/\u65e5\u671f\u52a0\u4e00\n    convert(x, y, z + 1);\n    t1 = ans[x2][y2][z2];\n\n    \/\/\u6708\u4efd\u52a0\u4e00\uff0c\u4e0d\u80fd\u7528convert\u51fd\u6570\uff0c\u56e0\u4e3a\u4e0d\u662f\u6bcf\u4e2a\u6708\u4efd\u52a01\u90fd\u662f\u5408\u6cd5\u7684\n    y++;\n    if (y == 13)\n    {\n        x++;\n        y = 1;\n    }\n    x2 = x, y2 = y, z2 = z;\n    t2 = ans[x2][y2][z2]; \/\/\u5982\u679c\u65e5\u671f\u4e0d\u5408\u6cd5\u5219t2=0\n\n    if (t1 == 1 &amp;&amp; t2 == 1)\n        return -1;\n    if (t1 == 1 &amp;&amp; t2 == 0) \/\/ t2\u7b49\u4e8e0\u4e14t1==1\uff0c\u6b64\u65f6\u65e5\u671f\u662f\u4e0d\u5408\u6cd5\u7684\u3002\n        return -1;\n    return 1;\n}\n\nint main()\n{\n    int t, x, y, z;\n    x = 2001, y = 12, z = 4; \/\/\u4ece2001\u5e7412\u6708\u5f00\u59cb\u641c\u7d22\uff0c\u800c\u4e0d\u662f2001\u5e74\n    while (!(x == 1899 &amp;&amp; y == 12 &amp;&amp; z == 31))\n    {\n        ans[x][y][z] = f(x, y, z);\n        convert(x, y, z - 1); \/\/\u65e5\u671f\u51cf\u4e00\n        x = x2, y = y2, z = z2;\n    }\n    cin &gt;&gt; t;\n    while (t--)\n    {\n        cin &gt;&gt; x &gt;&gt; y &gt;&gt; z;\n        if (ans[x][y][z] == 1)\n            cout &lt;&lt; \"YES\" &lt;&lt; endl;\n        else\n            cout &lt;&lt; \"NO\" &lt;&lt; endl;\n    }\n    return 0;\n}\n<\/code><\/pre>\n<h3>AC\u4ee3\u78012<\/h3>\n<pre><code class=\"language-cpp line-numbers\">#include &lt;bits\/stdc++.h&gt;\nusing namespace std;\n\nint main()\n{\n    int t;\n    cin &gt;&gt; t;\n    while (t--)\n    {\n        int x, y, z;\n        cin &gt;&gt; x &gt;&gt; y &gt;&gt; z;\n        if ((y == 9 &amp;&amp; z == 30) || (y == 11 &amp;&amp; z == 30))\/\/\u7279\u6b8a\u60c5\u51b5\n            cout &lt;&lt; \"YES\" &lt;&lt; endl;\n        else if ((y + z) % 2 == 0)\n            cout &lt;&lt; \"YES\" &lt;&lt; endl;\n        else\n            cout &lt;&lt; \"NO\" &lt;&lt; endl;\n    }\n    return 0;\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u63cf\u8ff0 Adam\u548cEve\u73a9\u4e00\u4e2a\u6e38\u620f\uff0c\u4ed6\u4eec\u5148\u4ece1900.1.1\u52302001.11.4\u8fd9\u4e2a\u65e5\u671f\u4e4b\u95f4\u968f\u610f\u62bd\u53d6\u4e00\u4e2a\u65e5\u671f\u51fa\u6765 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[29,40,41,61],"class_list":["post-293","post","type-post","status-publish","format-standard","hentry","category-algo","tag-vijos","tag-40","tag-41","tag-61"],"_links":{"self":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=293"}],"version-history":[{"count":0,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/293\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}