{"id":145,"date":"2024-04-26T14:38:33","date_gmt":"2024-04-26T06:38:33","guid":{"rendered":"https:\/\/seanxd.com\/?p=145"},"modified":"2024-04-26T14:38:35","modified_gmt":"2024-04-26T06:38:35","slug":"zerojudge-a135","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-a135\/","title":{"rendered":"ZeroJudge A135: Language Detection"},"content":{"rendered":"\n\n\n<h3 class=\"wp-block-heading\">\u540c\u984c\uff1aUVa 12250 &#8211; Language Detection<\/h3>\n\n\n\n<p class=\"\">\u82f1\u6587\u3001\u897f\u73ed\u7259\u6587\u3001\u5fb7\u6587\u3001\u6cd5\u6587\u3001\u7fa9\u5927\u5229\u6587\u53ca\u4fc4\u6587\u70ba\u6b50\u76df\u570b\u5bb6\u4e2d\u6700\u76db\u884c\u7684 6 \u7a2e\u8a9e\u8a00\u3002\u4e0b\u5716\u986f\u793a\u82f1\u8a9e\u4eba\u53e3\u5728\u6b50\u6d32\u5404\u570b\u7684\u5bc6\u5ea6\u3002\u9019\u4e9b\u8a9e\u8a00\u90fd\u6709\u4e0d\u540c\u7684\u5b57\u4f86\u8868\u793a\u82f1\u6587\u7684\u300cHELLO\u300d\u3002\u4f8b\u5982\u897f\u73ed\u7259\u6587\u4e2d\u7b49\u540c\u65bc\u82f1\u6587\u300cHELLO\u300d\u7684\u5b57\u662f\u300cHOLA\u300d\uff0c\u800c\u5fb7\u6587\u3001\u6cd5\u6587\u3001\u7fa9\u5927\u5229\u6587\u53ca\u4fc4\u6587\u4e2d\u610f\u601d\u70ba (\u6216\u76f8\u8fd1) \u300cHELLO\u300d\u7684\u5b57\u4f9d\u5e8f\u70ba\u300cHALLO\u300d\u3001\u300cBONJOUR\u300d\u3001\u300cCIAO\u300d\u548c\u300cZDRAVSTVUJTE\u300d\u3002<\/p>\n\n\n\n<p class=\"\">\u4f60\u5728\u672c\u984c\u4e2d\u7684\u4efb\u52d9\u975e\u5e38\u7c21\u55ae\u3002\u7d66\u4f60\u4ee5\u4e0a\u7684\u5e7e\u500b\u55ae\u5b57\u4e4b\u4e00\u6216\u662f\u5176\u4ed6\u7684\u55ae\u5b57\uff0c\u4f60\u9700\u8981\u8fa8\u8b58\u5b83\u662f\u54ea\u4e00\u7a2e\u8a9e\u8a00\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full nfd-wb-animate nfd-wb-zoom-in-short\"><img decoding=\"async\" width=\"299\" height=\"306\" loading=\"lazy\" src=\"https:\/\/seanxd.com\/wp-content\/uploads\/2024\/04\/Language-Detection.gif\" alt=\"ZeroJudge A135: Language Detection\n\u82f1\u8a9e\u4eba\u53e3\u65bc\u6b50\u6d32\u5404\u570b\u5bc6\u5ea6\" class=\"wp-image-146\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-table nfd-wb-animate nfd-wb-fade-in-bottom-short nfd-delay-50\"><table class=\"has-fixed-layout\"><thead><tr><th>\u8a9e\u8a00<\/th><th>HELLO \u7ffb\u8b6f<\/th><\/tr><\/thead><tbody><tr><td>English<\/td><td>HELLO<\/td><\/tr><tr><td>Spanish<\/td><td>HOLA<\/td><\/tr><tr><td>German<\/td><td>HALLO<\/td><\/tr><tr><td>French<\/td><td>BONJOUR<\/td><\/tr><tr><td>Italian<\/td><td>CIAO<\/td><\/tr><tr><td>Russian<\/td><td>ZDRAVSTVUJTE<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Hello \u8a9e\u8a00\u5c0d\u7167\u8868<\/figcaption><\/figure>\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 nfd-delay-150\"><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\u542b\u6709\u5927\u7d04 2000 \u884c\u7684\u8f38\u5165\u3002\u6bcf\u884c\u542b\u6709\u4e00\u500b\u5b57\u4e32 S\u3002\u4f60\u53ef\u4ee5\u5047\u8a2d<strong>\u6240\u6709\u7684\u5b57\u6bcd\u90fd\u662f\u5927\u5beb\u82f1\u6587\u5b57\u6bcd<\/strong>\uff0c\u4e14\u5b57\u4e32\u7684<strong>\u6700\u5927\u9577\u5ea6\u70ba 14<\/strong>\u3002\u8f38\u5165\u4ee5\u50c5\u542b\u6709\u4e00\u500b<strong>\u300c#\u300d\u7684\u4e00\u884c\u4f5c\u70ba\u7d50\u675f<\/strong>\uff0c\u8a72\u884c\u4e0d\u9700\u8655\u7406\u3002<\/td><td>\u9664\u4e86\u6700\u5f8c\u4e00\u884c\u4ee5\u5916\uff0c\u6bcf\u4e00\u884c\u8f38\u5165\u90fd\u8981\u6709\u4e00\u884c\u8f38\u51fa\u3002<br>\u9019\u884c\u8f38\u51fa\u542b\u6709\u8f38\u51fa\u7684<strong>\u5e8f\u865f\u53ca\u8a9e\u8a00\u540d\u7a31<\/strong>\u3002\u5982\u679c\u8f38\u5165\u5b57\u4e32\u662f<strong>\u8868\u683c\u4ee5\u5916\u7684\u5b57\u4e32<\/strong>\u5247\u5370\u51fa\u5b57\u4e32<strong>\u300cUNKNOWN\u300d<\/strong>\u3002\u6240\u6709\u7684\u8f38\u51fa\u5b57\u4e32\u4e5f\u90fd\u662f\u5927\u5beb\u3002<\/td><\/tr><tr><td>HELLO<br>HOLA<br>HALLO<br>BONJOUR<br>CIAO<br>ZDRAVSTVUJTE<br>#<\/td><td>Case  1:  ENGLISH<br>Case  2:  SPANISH<br>Case  3:  GERMAN<br>Case  4:  FRENCH<br>Case  5:  ITALIAN<br>Case  6:  RUSSIAN<\/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 <strong>If<\/strong> \u4f86\u5224\u65b7\u8a72\u5b57\u4e32\u7684\u8a9e\u8a00\u70ba\u4f55\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e00\u500b Int \u8b8a\u6578\u653e\u5728 EOF \u5916\u9762\u4f86\u78ba\u8a8d\u76ee\u524d\u662f\u7b2c\u5e7e\u500bCase\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=a135\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge A135: Language Detection<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap nfd-wb-animate nfd-wb-reveal-right nfd-delay-300\"><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 count = 1;\n  string str;\n  while (cin &gt;&gt; str)\n    {\n      if (str == &quot;#&quot;) break;\n      else\n      {\n        if (str == &quot;HELLO&quot;) cout &lt;&lt; &quot;Case &quot; &lt;&lt; count &lt;&lt; &quot;: ENGLISH&quot; &lt;&lt; endl;\n        else if (str == &quot;HOLA&quot;) cout &lt;&lt; &quot;Case &quot; &lt;&lt; count &lt;&lt; &quot;: SPANISH&quot; &lt;&lt; endl;\n        else if (str == &quot;HALLO&quot;) cout &lt;&lt; &quot;Case &quot; &lt;&lt; count &lt;&lt; &quot;: GERMAN&quot; &lt;&lt; endl;\n        else if (str == &quot;BONJOUR&quot;) cout &lt;&lt; &quot;Case &quot; &lt;&lt; count &lt;&lt; &quot;: FRENCH&quot; &lt;&lt; endl;\n        else if (str == &quot;CIAO&quot;) cout &lt;&lt; &quot;Case &quot; &lt;&lt; count &lt;&lt; &quot;: ITALIAN&quot; &lt;&lt; endl;\n        else if (str == &quot;ZDRAVSTVUJTE&quot;) cout &lt;&lt; &quot;Case &quot; &lt;&lt; count &lt;&lt; &quot;: RUSSIAN&quot; &lt;&lt; endl;\n        else cout &lt;&lt; &quot;Case &quot; &lt;&lt; count &lt;&lt; &quot;: UNKNOWN&quot; &lt;&lt; endl;\n        count++;\n      }\n    }\n}\n\n\/\/ZeroJudge A135\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 12250 &#8211; Language Detection \u82f1\u6587\u3001\u897f\u73ed\u7259\u6587\u3001\u5fb7\u6587\u3001\u6cd5\u6587\u3001\u7fa9 [&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],"class_list":["post-145","post","type-post","status-publish","format-standard","hentry","category-uva","tag-8","tag-11"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/145","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=145"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/145\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/145\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}