{"id":479,"date":"2024-05-14T09:00:00","date_gmt":"2024-05-14T01:00:00","guid":{"rendered":"https:\/\/seanxd.com\/?p=479"},"modified":"2024-05-04T03:12:47","modified_gmt":"2024-05-03T19:12:47","slug":"zerojudge-k513","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-k513\/","title":{"rendered":"ZeroJudge K513: \u505c\u8eca\u5834 (Parking)"},"content":{"rendered":"\n\n\n<p class=\"\">\u767e\u8ca8\u516c\u53f8\u505c\u8eca\u5834\u6703\u4f9d\u8eca\u5b50\u7684\u5927\u5c0f\u8a2d\u6709\u4e09\u7a2e\u985e\u578b\u7684\u505c\u8eca\u683c\uff1a<strong>\u5c0f\u578b\u3001\u4e2d\u578b\u4ee5\u53ca\u5927\u578b\u505c\u8eca\u683c<\/strong>\u3002<\/p>\n\n\n\n<p class=\"\">\u5176\u4e2d\u5c0f\u578b\u505c\u8eca\u683c\u9069\u5408\u5927\u5c0f\u5728 1 \u5230 199 \u9593\u7684\u8eca\u5b50\uff0c\u4e2d\u578b\u505c\u8eca\u683c\u9069\u5408\u5927\u5c0f\u5728 200 \u5230 499 \u9593\u7684\u8eca\u5b50\uff0c\u5927\u65bc\u7b49\u65bc 500 \u5247\u9069\u5408\u505c\u653e\u5728\u5927\u578b\u505c\u8eca\u683c\u4e2d\u3002<\/p>\n\n\n\n<p class=\"\">\u6bcf\u9593\u505c\u8eca\u5834\u90fd\u6703\u91dd\u5c0d\u4e0d\u540c\u985e\u578b\u8eca\u5b50\u5206\u914d\u4e0d\u540c\u6578\u91cf\u7684\u505c\u8eca\u683c\u3002\u70ba\u4e86\u66f4\u6709\u6548\u5229\u7528\u5834\u5730\uff0c<strong>\u7576\u4e00\u985e\u578b\u7684\u505c\u8eca\u683c\u5df2\u6eff\uff0c\u8eca\u5b50\u53ef\u4ee5\u505c\u653e\u5230\u6bd4\u4ed6\u5927\u7684\u505c\u8eca\u683c\u4e2d<\/strong>\u3002<\/p>\n\n\n\n<p class=\"\">\u8209\u4f8b\u4f86\u8aaa\uff1a\u5982\u679c\u5c0f\u578b\u505c\u8eca\u683c\u505c\u6eff\uff0c\u5c0f\u578b\u8eca\u53ef\u4ee5\u505c\u5230\u4e2d\u578b\u505c\u8eca\u683c\u7684\u4f4d\u7f6e\uff0c\u4f46\u82e5\u5927\u578b\u505c\u8eca\u683c\u505c\u6eff\uff0c\u7121\u6cd5\u505c\u5230\u4e2d\u578b\u6216\u5c0f\u578b\u505c\u8eca\u683c\u3002<\/p>\n\n\n\n<p class=\"\">\u8acb\u4f60\u5e6b\u5fd9\u8a08\u7b97<strong>\u7576\u524d\u505c\u8eca\u5834\u6700\u591a\u53ef\u4ee5\u505c\u653e\u7684\u8eca\u5b50\u6578\u91cf<\/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>\u8f38\u5165\u7b2c\u4e00\u5217\u6709\u4e09\u500b\u6574\u6578S\u3001M\u3001\u548c L (1 \u2264 S \u2264 100\uff0c1 \u2264 M \u2264 100\uff0c1 \u2264 L \u2264 100) \u4ee3\u8868\u5c0f\u578b\u3001\u4e2d\u578b\u548c\u5927\u578b\u505c\u8eca\u683c\u6578\u91cf\u3002<br>\u7b2c\u4e8c\u5217\u6709\u4e00\u500b\u6b63\u6574\u6578 N (1 \u2264 N \u2264 300) \u8868\u793a\u8981\u505c\u8eca\u7684\u8eca\u5b50\u6578\u91cf\u3002\u7b2c\u4e09\u5217\u6709 N \u500b\u6b63\u6574\u6578 X<sub>i<\/sub> (1 \u2264 X \u2264 1000\uff0c1 \u2264 i \u2264 N) \u8868\u793a\u6bcf\u53f0\u8eca\u5b50\u7684\u5927\u5c0f\u3002\u8f38\u5165\u4e2d\u76f8\u9130\u7684\u5169\u500b\u6578\u503c\u4ee5\u7a7a\u683c\u9593\u9694\u3002<\/td><td>\u8f38\u51fa\u4e00\u6578\u5b57\u8868\u793a\u6700\u591a\u53ef\u4ee5\u505c\u653e\u7684\u8eca\u5b50\u6578\u91cf\u3002<\/td><\/tr><tr><td>2  1  1<br>4<br>20  30  40  50<\/td><td>4<\/td><\/tr><tr><td>4  1  2<br>7<br>800  400  100  250  600  300  650<\/td><td>4<\/td><\/tr><tr><td>3  4  0<br>8<br>210  190  170  150  130  110  900  70<\/td><td>7<\/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=\"\">\u5ba3\u544a\u4e00\u500b\u9663\u5217\uff0c\u4e26\u5c07 S\u3001M\u3001L \u6536\u5230\u9019\u500b\u9663\u5217\u7684\u7b2c 0 \u500b\u5230\u7b2c 2 \u500b\u4f4d\u7f6e\u3002<\/p>\n\n\n\n<p class=\"\">\u5ba3\u544a\u4e00\u500b Start \u7684\u8b8a\u6578\uff0c\u5982\u679c\u8eca\u5b50\u70ba\u5c0f\u578b\u8eca\u5247\u8a2d\u70ba 0\u3001\u4e2d\u578b\u8eca\u8a2d\u70ba 1\u3001\u5927\u578b\u8eca\u8a2d\u70ba 2\u3002<\/p>\n\n\n\n<p class=\"\">\u8dd1\u4e00\u500b <strong>For\u8ff4\u5708 \u5f9e Start \u5230 3<\/strong>\uff0c<strong>\u5982\u679c \u9663\u5217[i] > 0\uff0c\u5247\u5c07 \u9663\u5217[i]&#8211; \u4e26\u5c07\u7b54\u6848 +1<\/strong>\uff0c\u8a18\u5f97\u8981<strong>\u5c07 For\u8ff4\u5708 Break \u6389<\/strong>\u3002\u6700\u5f8c\u8f38\u51fa\u7b54\u6848\u7684\u8b8a\u6578\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=k513\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge K513: \u505c\u8eca\u5834 (Parking)<\/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;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int arr[3] = {}, N, ans = 0;\n    cin &gt;&gt; arr[0] &gt;&gt; arr[1] &gt;&gt; arr[2] &gt;&gt; N;\n    for (int i = 0; i&lt;N; i++)\n    {\n        int tmp, start;\n        cin &gt;&gt; tmp;\n        if (tmp &lt;= 199) start = 0;\n        else if (tmp &lt;= 499) start = 1;\n        else start = 2;\n        for (int j = start; j&lt;3; j++)\n        {\n            if (arr[j] &gt; 0)\n            {\n                arr[j]--;\n                ans++;\n                break;\n            }\n        }\n    }\n    cout &lt;&lt; ans &lt;&lt; &quot;\\n&quot;;\n}\n\n\/\/ZeroJudge K513\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u767e\u8ca8\u516c\u53f8\u505c\u8eca\u5834\u6703\u4f9d\u8eca\u5b50\u7684\u5927\u5c0f\u8a2d\u6709\u4e09\u7a2e\u985e\u578b\u7684\u505c\u8eca\u683c\uff1a\u5c0f\u578b\u3001\u4e2d\u578b\u4ee5\u53ca\u5927\u578b\u505c\u8eca\u683c\u3002 \u5176\u4e2d\u5c0f\u578b\u505c\u8eca\u683c\u9069\u5408\u5927\u5c0f\u5728 1 \u5230 [&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":[25],"tags":[20,8,9],"class_list":["post-479","post","type-post","status-publish","format-standard","hentry","category-ioi-apcs","tag-20","tag-8","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/479","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=479"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/479\/revisions"}],"predecessor-version":[{"id":480,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/479\/revisions\/480"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}