{"id":279,"date":"2019-09-25T11:33:57","date_gmt":"2019-09-25T03:33:57","guid":{"rendered":"http:\/\/www.guanhaobo.cn\/?p=279"},"modified":"2019-09-25T11:33:57","modified_gmt":"2019-09-25T03:33:57","slug":"bjtuoj-1862-2018102","status":"publish","type":"post","link":"https:\/\/www.guanhaobo.cn\/?p=279","title":{"rendered":"BJTUOJ 1862 \u2014 2018102"},"content":{"rendered":"<h3>\u9898\u76ee<\/h3>\n<p>2018\u5e7410\u67082\u65e5\u662f\u4e00\u4e2a\u795e\u5947\u7684\u65e5\u5b50\uff0c\u56e0\u4e3a\u5c06\u6570\u5b57\u8fde\u8d77\u6765\u5c31\u53d8\u6210\u4e862018102\uff0c2018102\u662f\u4e00\u4e2a\u6b63\u8bfb\u5012\u8bfb\u90fd\u4e00\u6837\u7684\u6574\u6570\u3002<\/p>\n<p>\u90a3\u4e48\uff0c\u95ee\u9898\u6765\u4e86\uff0c\u4ece\u516c\u51431\u5e741\u67081\u65e5\u5230x\u5e74y\u6708z\u65e5\uff0c\u6709\u591a\u5c11\u4e2a\u8fd9\u6837\u795e\u5947\u7684\u65e5\u5b50\uff1f<\/p>\n<p>\u6ce8\u610f\uff1a\u5bf9\u4e8e\u4efb\u610f\u4e00\u5929\uff0ca\u5e74b\u6708c\u65e5\u4e2d\u7684a, b, c\u8fd9\u4e09\u4e2a\u6570\u90fd\u4e0d\u80fd\u6709\u524d\u5bfc\u96f6\uff0c\u4e14\u8981\u6c42\u662f\u5408\u6cd5\u7684\u65e5\u5b50\u3002\u522b\u5fd8\u8bb0\u8003\u8651\u95f0\u5e74\u3002<\/p>\n<h3>\u9898\u76ee\u94fe\u63a5<\/h3>\n<p><a href=\"https:\/\/citel.bjtu.edu.cn\/acm\/problem\/1862\" title=\"https:\/\/citel.bjtu.edu.cn\/acm\/problem\/1862\">https:\/\/citel.bjtu.edu.cn\/acm\/problem\/1862<\/a><\/p>\n<h3>\u8f93\u5165\u6570\u636e<\/h3>\n<p>\u4e09\u4e2a\u6574\u6570 x, y, z (1\u2264x\u22642018, 1\u2264y\u226412, 1\u2264z\u226431)<br \/>\n\u8868\u793ax\u5e74y\u6708z\u65e5\uff0c\u4fdd\u8bc1\u65e5\u671f\u5408\u6cd5\u3002<\/p>\n<h3>\u8f93\u51fa\u6570\u636e<\/h3>\n<p>\u56de\u6587\u65e5\u671f\u7684\u4e2a\u6570\uff08\u4e00\u4e2a\u6574\u6570\uff09\u3002<\/p>\n<h3>\u6837\u4f8b\u8f93\u5165<\/h3>\n<p><code>1000 1 1<\/code><\/p>\n<h3>\u6837\u4f8b\u8f93\u51fa<\/h3>\n<p><code>1487<\/code><\/p>\n<h3>\u95ee\u9898\u5206\u6790<\/h3>\n<p>\u4ece 111 \u679a\u4e3e\u5230 xyz\uff0c\u5224\u65ad\u662f\u5426\u662f\u56de\u6587\u6570\u5373\u53ef\u3002\u600e\u4e48\u5224\u65ad\u56de\u6587\u6570\u5462\uff0c\u53ef\u4ee5\u628a\u6570\u5b57\u53cd\u8f6c\u7136\u540e\u5224\u65ad\u662f\u5426\u548c\u539f\u6570\u5b57\u76f8\u7b49\uff0c\u4e5f\u53ef\u4ee5\u4ece\u9996\u5c3e\u5f00\u59cb\u9010\u4e2a\u5224\u65ad\u5bf9\u79f0\u4f4d\u7f6e\u7684\u6570\u5b57\u662f\u5426\u76f8\u7b49\u3002\u4e0d\u8fc7\u8981\u6ce8\u610f\u6bcf\u4e2a\u6708\u4efd\u6709\u51e0\u5929\u4ee5\u53ca\u95f0\u5e74\u7684\u95ee\u9898\u3002<br \/>\n30\u5929\uff1a4\u6708\u30016\u6708\u30019\u6708\u300111\u6708<br \/>\n31\u5929\uff1a1\u6708\u30013\u6708\u30015\u6708\u30017\u6708\u30018\u6708\u300110\u6708\u300112\u6708<br \/>\n\u6ce8\u610f2\u6708\u4efd\u5728\u5e73\u5e74\u670928\u5929\uff0c\u95f0\u5e74\u670929\u5929\u3002<br \/>\n\u95f0\u5e74\u7684\u5b9a\u4e49\u662f\uff1a\uff08\u80fd\u88ab4\u6574\u9664\u4f46\u4e0d\u80fd\u88ab100\u6574\u9664\uff09\u6216\u80fd\u88ab400\u6574\u9664<\/p>\n<p>\u6211\u7684\u57fa\u672c\u601d\u8def\u662f\u5148\u628a\u6570\u5b57\u8f6c\u6210\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u901a\u8fc7\u5224\u65ad\u5b57\u7b26\u4e32\u5bf9\u79f0\u4f4d\u7f6e\u7684\u5b57\u7b26\u662f\u5426\u76f8\u540c\u6765\u786e\u5b9a\u662f\u5426\u662f\u56de\u6587\u6570\u3002<\/p>\n<h3>AC\u4ee3\u7801<\/h3>\n<pre><code class=\"language-cpp line-numbers\">#include &lt;bits\/stdc++.h&gt;\nusing namespace std;\nint huiwen(string s)\n{\n    int i, j;\n    string s2 = s;\n    for (i = 0, j = s2.length() - 1; i &lt; s.length(); i++, j--)\n        if (s[i] != s2[j])\n            return 0;\n    return 1;\n}\n\nstring int_string(int n)\n{\n    char cs[100];\n    sprintf(cs, \"%d\", n);\n    return string(cs);\n}\n\nint main()\n{\n    string s;\n    int x, y, z, k, i, j, ans = 0;\n    cin &gt;&gt; x &gt;&gt; y &gt;&gt; z;\n    for (i = 1; i &lt; x; i++)\n    {\n        for (j = 1; j &lt;= 12; j++)\n        {\n            for (k = 1; k &lt;= 31; k++)\n            {\n                if (k == 31 &amp;&amp; (j == 4 || j == 6 || j == 9 || j == 11))\n                    continue;\n                if (j == 2 &amp;&amp; (k == 30 || k &gt; 28 &amp;&amp; !((i % 4 == 0 &amp;&amp; (i % 100)) || (i % 400 == 0))))\n                    break;\n                s = int_string(i) + int_string(j) + int_string(k);\n                if (huiwen(s))\n                    ans++;\n            }\n        }\n    }\n    for (i = x, j = 1; j &lt; y; j++)\n    {\n        for (k = 1; k &lt;= 31; k++)\n        {\n            if (k == 31 &amp;&amp; (j == 4 || j == 6 || j == 9 || j == 11))\n                continue;\n            if (j == 2 &amp;&amp; (k == 30 || k &gt; 28 &amp;&amp; !((i % 4 == 0 &amp;&amp; (i % 100)) || (i % 400 == 0))))\n                break;\n            s = int_string(i) + int_string(j) + int_string(k);\n            if (huiwen(s))\n                ans++;\n        }\n    }\n    for (i = x, j = y, k = 1; k &lt;= z; k++)\n    {\n        if (k == 31 &amp;&amp; (j == 4 || j == 6 || j == 9 || j == 11))\n            continue;\n        if (j == 2 &amp;&amp; (k == 30 || k &gt; 28 &amp;&amp; !((i % 4 == 0 &amp;&amp; (i % 100)) || (i % 400 == 0))))\n            break;\n        s = int_string(i) + int_string(j) + int_string(k);\n        if (huiwen(s))\n            ans++;\n    }\n    cout &lt;&lt; ans &lt;&lt; endl;\n    return 0;\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9898\u76ee 2018\u5e7410\u67082\u65e5\u662f\u4e00\u4e2a\u795e\u5947\u7684\u65e5\u5b50\uff0c\u56e0\u4e3a\u5c06\u6570\u5b57\u8fde\u8d77\u6765\u5c31\u53d8\u6210\u4e862018102\uff0c2018102\u662f\u4e00\u4e2a\u6b63\u8bfb\u5012 [&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":[7,53],"class_list":["post-279","post","type-post","status-publish","format-standard","hentry","category-algo","tag-bjtuoj","tag-53"],"_links":{"self":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/279","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=279"}],"version-history":[{"count":0,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/279\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}