{"id":520,"date":"2024-05-31T09:00:00","date_gmt":"2024-05-31T01:00:00","guid":{"rendered":"https:\/\/seanxd.com\/?p=520"},"modified":"2024-05-07T18:06:00","modified_gmt":"2024-05-07T10:06:00","slug":"zerojudge-a221","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-a221\/","title":{"rendered":"ZeroJudge A221: Big Number of Teams Will Solve This"},"content":{"rendered":"\n\n\n<h4 class=\"wp-block-heading\">\u540c\u984c\uff1aUVa 11734 &#8211; Big Number of Teams will Solve This<\/h4>\n\n\n\n<p class=\"\">\u70ba\u4e00\u500b\u7c21\u55ae\u7684\u7a0b\u5f0f\u984c\u76ee\u64b0\u5beb\u4e00\u500b\u7a0b\u5f0f\u78bc\u4e26\u4e0d\u662f\u592a\u5927\u7684\u554f\u984c\uff0c\u4f46\u662f\u7f3a\u4e4f\u7d93\u9a57\u7684\u65b0\u4eba\u4e26\u4e0d\u592a\u77e5\u9053\uff0c\u81ea\u5df1\u7684\u8f38\u51fa\u9700\u8981\u5b8c\u5168\u8207 Judges\u7684\u76f8\u540c\u3002<\/p>\n\n\n\n<p class=\"\">\u901a\u5e38\u7684\u6642\u5019\uff0c\u4ed6\u5011\u6703\u8f38\u51fa\u591a\u9918\u7684\u7a7a\u683c\uff0c\u56e0\u70ba\u4ed6\u5011\u8a8d\u70ba\u9019\u6a23\u6703\u8b93\u8f38\u51fa\u8b8a\u7684\u66f4\u597d\u770b\u3002<\/p>\n\n\n\n<p class=\"\">\u4f46\u662f\u771f\u5be6\u7684\u72c0\u6cc1\u662f\uff1a\u4f60\u8f38\u51fa\u7684\u6bcf\u4e00\u500b\u5b57\u5143\u90fd\u61c9\u8a72\u8ddf Judges \u7684\u4e00\u6a21\u4e00\u6a23\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c\u5728\u63d0\u4ea4 Judges \u7684\u6642\u5019\u591a\u8f38\u51fa\u7a7a\u683c,\u4f60\u5c07\u6703\u5f97\u5230\u300c\u8f38\u51fa\u683c\u5f0f\u932f\u8aa4\u300d(Output Format Error)\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c\u5728 Judges \u5ffd\u7565\u7a7a\u683c\u5f8c\uff0c\u8f38\u51fa\u4ecd\u4e0d\u6b63\u78ba\uff0c\u5247\u6703\u5f97\u5230\u300c\u932f\u8aa4\u7b54\u6848\u300d(Wrong Answer)\u3002<\/p>\n\n\n\n<p class=\"\">\u800c\u300c\u6b63\u78ba\u300d(Yes) \u5247\u6703\u5728\u8f38\u51fa\u5b8c\u5168\u5339\u914d\u7684\u6642\u5019\u7372\u5f97\u3002<\/p>\n\n\n\n<p class=\"\">\u5728\u9019\u4e00\u984c\uff0c\u4f60<strong>\u9700\u8981\u5224\u5b9a\u63d0\u4ea4\u8005\u7684\u8f38\u51fa \uff0c\u4e26\u4e14\u7d66\u51fa Judges \u7684\u5224\u5b9a<\/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>\u5728\u7b2c\u4e00\u884c\u6703\u7d66\u51fa\u4e00\u500b\u6b63\u6574\u6578 T (T &lt; 20) \u4ee3\u8868 \u5171\u6709\u5e7e\u7d44\u8cc7\u6599<br>\u6bcf\u7d44\u8cc7\u6599\u6703\u6709\u5169\u884c<br><strong>\u7b2c\u4e00\u884c\u70ba \u968a\u4f0d\u7684\u8f38\u51fa<br>\u7b2c\u4e8c\u884c\u662f Judges \u7684\u8f38\u51fa<\/strong><br>\u6bcf\u884c\u81f3\u5c11\u6703\u6709\u4e00\u500b\u5b57\uff0c\u6700\u591a 20 \u500b\u5b57<br>\u968a\u4f0d\u7684\u7684\u8f38\u51fa\u7531\u7a7a\u767d\u8ddf\u5b57\u7d44\u6210\uff0cJudges \u7684\u8f38\u51fa\u5247\u53ea\u6709\u5b57<\/td><td>\u5c0d\u65bc\u6bcf\u7d44\u8cc7\u6599<br>\u4f60\u9700\u8981\u8f38\u51fa\u4e00\u884c<br>\u6bcf\u4e00\u884c\u5305\u542b\u4e86<strong>\u88c1\u6c7a\u7de8\u865f \u8ddf \u88c1\u6c7a\u7d50\u679c<\/strong><br>\u8acb\u770b\u7bc4\u4f8b\u6e2c\u8a66<\/td><\/tr><tr><td>3<br>yes<br>yes<br>Casematters<br>casematters<br>no space        please<br>nospaceplease<\/td><td>Case 1: Yes<br>Case 2: Wrong Answer<br>Case 3: Output Format Error<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">ZeroJudge A221 \u7bc4\u4f8b\u6e2c\u8cc7<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p class=\"\">\u4f7f\u7528 Getline \u4f86\u6536\u5b57\u4e32\uff0c\u6536\u5b8c T \u4e4b\u5f8c\u8a18\u5f97\u8981\u5148 cin.ignore()\u3002\u6536\u5b8c\u8cc7\u6599\u4e4b\u5f8c\u5982\u679c\u5169\u500b\u5b57\u4e32\u60f3\u540c\u7684\u8a71\u5c31\u53ef\u4ee5\u76f4\u63a5\u8f38\u51fa\u300cYes\u300d\uff0c\u5982\u679c\u4e0d\u76f8\u540c\u7684\u8a71\u624d\u8981\u505a\u4e0b\u9762\u7684\u5224\u65b7\u3002<\/p>\n\n\n\n<p class=\"\">\u4f7f\u7528 Map \u4f86\u7d00\u9304<strong>\u6bcf\u500b\u300c\u975e\u7a7a\u767d\u300d\u5b57\u5143\u7684\u51fa\u73fe\u6b21\u6578<\/strong>\uff0c\u8dd1\u300c\u968a\u4f0d\u8f38\u51fa\u300d\u7684\u6642\u5019\u5c07 Map[\u5b57\u5143]++\uff0c\u8dd1\u300cJudges \u8f38\u51fa\u300d\u7684\u6642\u5019\u5c07 Map[\u5b57\u5143]&#8211;\u3002<\/p>\n\n\n\n<p class=\"\">\u8dd1 for (auto it:Map)\uff0c\u4e26\u4e14\u9810\u8a2d\u4e00\u500b WA \u7684\u5e03\u6797\u503c\u70ba False\uff0c\u5982\u679c\u8dd1\u8ff4\u5708\u7684\u6642\u5019\u6709\u4efb\u4f55\u4e00\u500b it.second != 0\uff0c\u5247\u4ee3\u8868\u6709\u591a\u9918\u6216\u662f\u6709\u5c11\u5b57\u5143\uff0c\u5c07 WA \u8a2d\u70ba True \u4e4b\u5f8c Break \u8ff4\u5708\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c WA == True\uff0c\u5247\u8f38\u51fa\u300cWrong Answer\u300d\uff0c\u82e5\u8ff4\u5708\u7d50\u675f\u5f8c\u9084\u662f False\uff0c\u5247\u4ee3\u8868\u53ea\u662f\u591a\u8f38\u51fa\u7a7a\u683c\u8f38\u51fa\u300cOutput Format Error\u300d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=a221\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge A221: Big Number of Teams Will Solve This<\/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;map&gt;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int N;\n    cin &gt;&gt; N;\n    cin.ignore();\n    for (int i = 0; i&lt;N; i++)\n    {\n        string a, b;\n        getline(cin, a);\n        getline(cin, b);\n        cout &lt;&lt; &quot;Case &quot; &lt;&lt; i+1 &lt;&lt; &quot;: &quot;;\n        if (a == b) cout &lt;&lt; &quot;Yes\\n&quot;;\n        else\n        {\n            map&lt;char, int&gt;MAP;\n            for (int j = 0; j&lt;a.length(); j++)\n            {\n                if (a[j] != &#39; &#39;) MAP[a[j]]++;\n            }\n            for (int j = 0; j&lt;b.length(); j++)\n            {\n                if (b[j] != &#39; &#39;) MAP[b[j]]--;\n            }\n            bool WA = false;\n            for (auto it:MAP)\n            {\n                if (it.second != 0)\n                {\n                    WA = true;\n                    break;\n                }\n            }\n            if (WA) cout &lt;&lt; &quot;Wrong Answer\\n&quot;;\n            else cout &lt;&lt; &quot;Output Format Error\\n&quot;;\n        }\n    }\n}\n\n\/\/ZeroJudge A221\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 11734 &#8211; Big Number of Teams will Solve Thi [&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":[14,8,11,9],"class_list":["post-520","post","type-post","status-publish","format-standard","hentry","category-uva","tag-map","tag-8","tag-11","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/comments?post=520"}],"version-history":[{"count":2,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/520\/revisions"}],"predecessor-version":[{"id":522,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/520\/revisions\/522"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}