{"id":437,"date":"2024-05-03T13:21:46","date_gmt":"2024-05-03T05:21:46","guid":{"rendered":"https:\/\/seanxd.com\/?p=437"},"modified":"2024-05-03T13:21:49","modified_gmt":"2024-05-03T05:21:49","slug":"zerojudge-a520","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-a520\/","title":{"rendered":"ZeroJudge A520: Excessive Space Remover"},"content":{"rendered":"\n\n\n<h4 class=\"wp-block-heading\">\u540c\u984c\uff1aUVa 12416 &#8211; Excessive Space Remover<\/h4>\n\n\n\n<p class=\"\">\u5728\u50cf Windows \u8a18\u4e8b\u672c\u9019\u985e\u7684\u7de8\u8f2f\u5668\u4e2d\u8981\u5982\u4f55\u79fb\u9664\u9023\u7e8c\u7684\u7a7a\u767d\uff1f<strong>\u6211\u5011\u53ef\u4ee5\u91cd\u8986\u5730\u4ee5\u4e00\u500b\u7a7a\u767d\u300c\u5168\u90e8\u53d6\u4ee3\u300d\u5169\u500b\u9023\u7e8c\u7684\u7a7a\u767d (\u6211\u5011\u7a31\u4e4b\u70ba\u4e00\u500b\u52d5\u4f5c)<\/strong>\u3002\u672c\u984c\u4e2d\u4f60\u8981\u6a21\u64ec\u9019\u500b\u7a0b\u5e8f\u4e26\u56de\u5831<strong>\u9700\u8981\u5e7e\u500b\u300c\u5168\u90e8\u53d6\u4ee3\u300d<\/strong>\u7684\u52d5\u4f5c\u3002<\/p>\n\n\n\n<p class=\"\">\u6bd4\u5982\u8aaa\uff0c\u5982\u679c\u4f60\u8981\u79fb\u9664\u300cA very big joke.\u300d\u4e2d\u7684\u9023\u7e8c\u7a7a\u767d\uff0c\u4f60\u9700\u8981\u5169\u500b\u52d5\u4f5c\uff1a<\/p>\n\n\n\n<p class=\"\">\u300cA very  big     joke.\u300d -> \u300cA very big   joke.\u300d -> \u300cA very big joke.\u300d<\/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\u4e00\u884c\u3002\u6bcf\u884c\u542b\u6709\u5b57\u6bcd\u3001\u6578\u5b57\u3001\u6a19\u9ede\u7b26\u865f\u53ca\u7a7a\u767d (\u53ef\u80fd\u6709\u524d\u5c0e\u7a7a\u767d\uff0c\u4f46\u4e0d\u6703\u6709\u5f8c\u7f6e\u7a7a\u767d)\u3002\u8f38\u5165\u4e2d<strong>\u4e0d\u6703\u6709 TAB \u5b57\u5143<\/strong>\u3002\u8f38\u5165\u6a94\u5927\u5c0f\u4e0d\u6703\u8d85\u904e 1MB\u3002<\/td><td>\u5c0d\u65bc\u6bcf\u4e00\u884c\uff0c\u5370\u51fa\u79fb\u9664\u6240\u6709\u9023\u7e8c\u7a7a\u767d\u6240\u9700\u7684\u52d5\u4f5c\u6b21\u6578\u3002<\/td><\/tr><tr><td>A very  big    joke.<br>        Goodbye!<\/td><td>2<br>4<\/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 While \u8ff4\u5708\u4f86\u9032\u884c\u52d5\u4f5c\uff0c\u6bcf\u6b21\u8dd1 For\u8ff4\u5708 \u5f9e\u5de6\u5230\u53f3\u5224\u65b7\uff0c\u6bcf\u6b21\u90fd\u5c07\u5b57\u4e32\u52a0\u5230\u4e00\u500b\u65b0\u7684\u5b57\u4e32\uff0c<strong>\u5982\u679c\u76ee\u524d\u5b57\u5143\u70ba\u7a7a\u683c\u4e14\u4e0b\u4e00\u500b\u5b57\u5143\u4e5f\u662f\u7a7a\u683c\uff0c\u5247\u5c07 i+1 \u4f86\u8df3\u904e\u4e0b\u4e00\u500b\u7a7a\u683c\u5b57\u5143<\/strong>\u3002<\/p>\n\n\n\n<p class=\"\">\u9700\u8981\u6ce8\u610f<strong>\u4e0d\u53ef\u4ee5\u8d85\u904e\u5b57\u4e32\u9577\u5ea6\u7bc4\u570d<\/strong>\uff0c\u6240\u4ee5\u5224\u65b7\u6642\u8981<strong>\u5148\u5224\u65b7\u76ee\u524d\u662f\u5426\u5df2\u7d93\u8dd1\u5230\u5b57\u4e32\u7684\u6700\u5f8c\u4e00\u500b\u5b57\u5143<\/strong>\u3002\u8f38\u51fa\u8dd1 While \u8ff4\u5708\u7684\u6b21\u6578 -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=a520\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge A520: Excessive Space Remover<\/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    string str;\n    while (getline(cin, str))\n    {\n        bool stop = false;\n        string newstr;\n        int count = 0;\n        while (!stop)\n        {\n            newstr = &quot;&quot;;\n            stop = true;\n            for (int i = 0; i&lt;str.length(); i++)\n            {\n                newstr += str[i];\n                if (str[i] == &#39; &#39; && i+1&lt;str.length() && str[i+1] == &#39; &#39;)\n                {\n                    i++;\n                    stop = false;\n                }\n            }\n            str = newstr;\n            count++;\n        }\n        cout &lt;&lt; count-1 &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge A520\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 12416 &#8211; Excessive Space Remover \u5728\u50cf Windows [&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":[8,11,9],"class_list":["post-437","post","type-post","status-publish","format-standard","hentry","category-uva","tag-8","tag-11","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/437","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=437"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/437\/revisions"}],"predecessor-version":[{"id":438,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/437\/revisions\/438"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}