{"id":543,"date":"2024-06-07T09:00:00","date_gmt":"2024-06-07T01:00:00","guid":{"rendered":"https:\/\/seanxd.com\/?p=543"},"modified":"2024-06-07T11:33:56","modified_gmt":"2024-06-07T03:33:56","slug":"zerojudge-a217","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-a217\/","title":{"rendered":"ZeroJudge A217: caps lock\u7684\u707d\u96e3"},"content":{"rendered":"\n\n\n<p>\u96fb\u8166\u7684\u6bcf\u500b\u9375\u76e4\u90fd\u5177\u6709\u4ed6\u5011\u5404\u81ea\u7684\u91cd\u8981\u529f\u80fd\uff0c<\/p>\n\n\n\n<p>\u8981\u662f\u54ea\u500b\u9375\u7a81\u7136\u51fa\u932f\u4e86\u90fd\u6703\u5e36\u4f86\u5de8\u5927\u7684\u56f0\u64fe\u3002<\/p>\n\n\n\n<p>\u4eca\u5929\u5047\u8a2d\u6709\u500b\u4eba\u53eb\u5c0f\u660e\uff0c\u4ed6\u7684\u96fb\u8166\u7684 caps lock \u9375\u58de\u6389\u4e86\uff0c<\/p>\n\n\n\n<p>\u6240\u4ee5\u4ed6\u6253\u51fa\u4f86\u7684\u82f1\u6587\u5b57\u5168\u90fd\u662f\u5c0f\u5beb\uff0c<\/p>\n\n\n\n<p>\u9019\u6642\u5c0f\u660e\u70ba\u4e86\u8b49\u660e\u4ed6\u6bcf\u500b\u661f\u671f\u5b78\u5beb\u7a0b\u5f0f\u662f\u5f88\u6709\u7528\u7684\uff0c<\/p>\n\n\n\n<p>\u4ed6\u6c7a\u5b9a\u5beb\u500b\u7a0b\u5f0f\uff0c\u53ef\u4ee5\u81ea\u52d5\u628a\u53e5\u5b50\u8f49\u6210\u6b63\u78ba\u7684\u5927\u5c0f\u5beb\u683c\u5f0f\u3002<\/p>\n\n\n\n<p>\u8acb\u4f60\u540c\u6a23\u5beb\u500b\u7a0b\u5f0f\u5b8c\u6210\u9019\u4ef6\u4e8b\u3002<\/p>\n\n\n\n<p>p.s. \u9019\u53ea\u662f\u8003\u8a66\u984c\u76ee\u5728\u5634\u7832\uff0c\u4e8b\u5be6\u4e0a\u4f60\u53ef\u4ee5\u7528 shift \u9375\u53d6\u4ee3 caps lock \u7684\u5927\u5beb\u529f\u80fd\uff0c<\/p>\n\n\n\n<p>\u6216\u662f\u9019\u7a2e\u6642\u5019\u6839\u672c\u5c31\u61c9\u8a72\u5118\u5feb\u628a\u96fb\u8166\u62ff\u53bb\u4fee\u3002&nbsp;<\/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>\u6bcf\u884c\u70ba\u4e00\u7b46\u55ae\u7368\u4e4b\u8cc7\u6599\uff0c\u50c5\u6709\u5c0f\u5beb\u5b57\u6bcd\u548c\u7a7a\u683c\u548c\u300c,\u300d\u3001\u300c.\u300d\u3001\u300c?\u300d\u3001\u300c!\u300d&nbsp;<br>\u6bcf\u884c\u4e0d\u8d85\u904e 1000 \u500b\u5b57\u5143&nbsp;<\/td><td>\u6bcf\u7b46\u8f38\u51fa\u4e00\u884c\uff0c&nbsp;<br>\u628a\u6bcf\u500b\u53e5\u5b50\u7b2c\u4e00\u500b\u82f1\u6587\u5b57\u6bcd\u8b8a\u5927\u5beb\uff0c<br>\u55ae\u7368\u7684 i \u4e5f\u8981\u8b8a\u6210\u5927\u5beb\u3002<\/td><\/tr><tr><td>yo! i am so fat. macbook air so cool!<br>me, too. battle!<br>who am i?<\/td><td>Yo! I am so fat. Macbook air so cool!<br>Me, too. Battle!<br>Who am I?<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p>\u8a2d\u5b9a\u4e00\u500b\u5e03\u6797\u503c cap\uff0c\u5982\u679c cap == true \u4ee3\u8868\u76ee\u524d\u7684\u5b57\u6bcd\u8981\u5927\u5beb\uff0c\u4e26\u4e14\u5c07 cap \u8a2d\u5b9a\u70ba false\u3002\u5982\u679c\u9047\u5230\u300c,\u300d\u3001\u300c.\u300d\u3001\u300c?\u300d\u3001\u300c!\u300d\uff0c\u5247\u5c07 cap \u8a2d\u5b9a\u70ba true\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u9047\u5230\u300ci\u300d\u9019\u500b\u5b57\u5143\uff0c\u5224\u65b7\u524d\u5f8c\u662f\u5426\u70ba\u7a7a\u683c\u6216\u8868\u9ede\u7b26\u865f\u3002\u9700\u8981\u6ce8\u610f\u8981\u5148\u5224\u65b7\u76ee\u524d\u5b57\u5143\u4f4d\u7f6e\u4ee5\u514d\u9020\u6210\u8a18\u61b6\u9ad4\u5340\u6bb5\u932f\u8aa4\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=a217\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge A217: caps lock\u7684\u707d\u96e3<\/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;cctype&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 cap = true;\n        string ans = &quot;&quot;;\n        for (int i = 0; i&lt;str.length(); i++)\n        {\n            if (isalpha(str[i]))\n            {\n                if (cap)\n                {\n                    ans += toupper(str[i]);\n                    cap = false;\n                }\n                else if (str[i] == &#39;i&#39;)\n                {\n                    if (i == 0 && str[i+1] == &#39; &#39;) ans += toupper(str[i]);\n                    else if (i == int(str.length())-1 && str[i-1] == &#39; &#39;) ans += toupper(str[i]);\n                    else\n                    {\n                        if ((str[i+1] == &#39; &#39; || str[i+1] == &#39;.&#39; || str[i+1] == &#39;?&#39; || str[i+1] == &#39;!&#39; || str[i+1] == &#39;,&#39;) && (str[i-1] == &#39; &#39; || str[i-1] == &#39;.&#39; || str[i-1] == &#39;?&#39; || str[i-1] == &#39;!&#39; || str[i-1] == &#39;,&#39;)) ans += toupper(str[i]);\n                        else ans += str[i];\n                    }\n                }\n                else ans += str[i];\n            }\n            else ans += str[i];\n            if (str[i] == &#39;.&#39; || str[i] == &#39;!&#39; || str[i] == &#39;?&#39;) cap = true;\n        }\n        cout &lt;&lt; ans &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge A217\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u96fb\u8166\u7684\u6bcf\u500b\u9375\u76e4\u90fd\u5177\u6709\u4ed6\u5011\u5404\u81ea\u7684\u91cd\u8981\u529f\u80fd\uff0c \u8981\u662f\u54ea\u500b\u9375\u7a81\u7136\u51fa\u932f\u4e86\u90fd\u6703\u5e36\u4f86\u5de8\u5927\u7684\u56f0\u64fe\u3002 \u4eca\u5929\u5047\u8a2d\u6709\u500b\u4eba\u53eb\u5c0f\u660e\uff0c\u4ed6\u7684 [&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":[29],"tags":[8,11,13,9],"class_list":["post-543","post","type-post","status-publish","format-standard","hentry","category-zerojudge-","tag-8","tag-11","tag-13","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/543","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=543"}],"version-history":[{"count":6,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/543\/revisions"}],"predecessor-version":[{"id":781,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/543\/revisions\/781"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}