{"id":484,"date":"2024-05-16T09:00:00","date_gmt":"2024-05-16T01:00:00","guid":{"rendered":"https:\/\/seanxd.com\/?p=484"},"modified":"2024-05-04T11:20:09","modified_gmt":"2024-05-04T03:20:09","slug":"zerojudge-c007","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-c007\/","title":{"rendered":"ZeroJudge C007: TeX Quotes"},"content":{"rendered":"\n\n\n<h4 class=\"wp-block-heading\">\u540c\u984c\uff1aUVa 00272 &#8211; TeX Quotes<\/h4>\n\n\n\n<p class=\"\">TeX \u662f\u4e00\u7a2e\u7531 Donald Knuth \u6240\u767c\u5c55\u51fa\u7684\u4e00\u5957\u6587\u66f8\u6392\u7248\u8edf\u9ad4\u3002\u9019\u5957\u8edf\u9ad4\u53ef\u4ee5\u5c07\u539f\u59cb\u6587\u4ef6\u6a94\u52a0\u4e0a\u4e00\u4e9b\u50cf\u5b57\u578b\u7b49\u578b\u614b\u5f8c\uff0c\u8f49\u6210\u4e00\u4efd\u5f88\u6f02\u4eae\u7684\u6587\u4ef6\u3002\u800c\u4e00\u4efd\u6f02\u4eae\u7684\u6587\u4ef6\u662f\u9700\u8981\u7528 \u548c &#8221; \u4f86\u628a\u5225\u4eba\u8aaa\u7684\u8a71\u7d66\u300c\u5f15\u300d\u51fa\u4f86\uff0c\u800c\u4e0d\u662f\u7528\u5927\u90e8\u4efd\u9375\u76e4\u4e0a\u6709\u7684 &#8221; \u3002\u96d6\u7136\u9375\u76e4\u88e1\u901a\u5e38\u4e0d\u6703\u6709\u9019\u7a2e\u6709\u65b9\u5411\u7684\u96d9\u5f15\u865f\u9375\uff0c\u4e0d\u904e\u4e0a\u9762\u6709\u5de6\u55ae\u5f15\u865f\uff40(\u6709\u4eba\u53eb Backquote\uff09\uff0c\u548c\u53f3\u55ae\u5f15\u865f &#8216; (\u6709\u4eba\u53eb Apostrophe \u6216 Quote\uff09\u3002\u4f60\u53ef\u4ee5\u5728\u4f60\u7684\u9375\u76e4\u4e0a\u627e\u4e00\u4e0b\uff0c\u4e0d\u904e\u8981\u5c0f\u5fc3\u4e0d\u8981\u5c07 ` \u8207 \\ (Backslash \u9375) \u641e\u6df7\u4e86\u3002\u800c\u5728 TeX \u88e1\uff0c\u4f7f\u7528\u8005\u53ef\u4ee5\u8f38\u5165\u5169\u500b\u5de6\u55ae\u5f15\u865f \u4f86\u69cb\u6210\u4e00\u500b\u5de6\u96d9\u5f15\u865f &#8220; \uff0c\u6216\u8005\u662f\u5169\u500b\u53f3\u55ae\u5f15\u865f &#8221; \u4f86\u69cb\u9020\u4e00\u500b\u53f3\u55ae\u5f15\u865f &#8221; \uff0c\u4e0d\u904e\u5462\uff0c\u901a\u5e38\u5927\u5bb6\u6253\u5b57\u6642\u90fd\u5f88\u7fd2\u6163\u7528\u666e\u901a\u7684\u96d9\u5f15\u865f &#8221; \u4f86\u5f15\u8ff0\u5225\u4eba\u7684\u8a71\u3002<\/p>\n\n\n\n<p class=\"\">\u5982\u679c\u539f\u59cb\u6587\u4ef6\u6a94\u5167\u5bb9\u662f\uff1a<\/p>\n\n\n\n<p class=\"\">&#8220;To be or not to be,&#8221; quoth the bard, &#8220;that is the question.&#8221;<\/p>\n\n\n\n<p class=\"\">\u5247 TeX \u4f5c\u51fa\u4f86\u7684\u6587\u4ef6\u4e26\u4e0d\u6703\u662f\u6211\u5011\u6240\u60f3\u8981\u7684\uff1a<\/p>\n\n\n\n<p class=\"\">To be or not to be,&#8221; quoth the bard, that is the question.&#8221;<\/p>\n\n\n\n<p class=\"\">\u70ba\u4e86\u8981\u5f97\u5230\u4e0a\u9762\u7684\u6587\u4ef6\uff0c\u6211\u5011\u9700\u8981\u628a\u539f\u59cb\u6587\u4ef6\u8b8a\u6210\u9019\u500b\u6a23\u5b50\uff1a<\/p>\n\n\n\n<p class=\"\">To be or not to be,&#8221; quoth the bard, that is the question.&#8221;<\/p>\n\n\n\n<p class=\"\">\u4f60\u73fe\u5728\u5fc5\u9808\u8981\u5beb\u4e00\u500b\u7a0b\u5f0f\uff0c\u5c07\u666e\u901a\u7684\u96d9\u5f15\u865f\uff08&#8221;\uff09\uff0c\u8f49\u6210\u6709\u65b9\u5411\u6027\u7684\u96d9\u5f15\u865f\uff0c\u800c\u5176\u5b83\u6587\u5b57\u5247\u4e0d\u8b8a\u3002\u800c\u5728\u628a\u666e\u901a\u7684\u96d9\u5f15\u865f\u63db\u6389\u7684\u6642\u5019\uff0c\u8981\u7279\u5225\u6ce8\u610f\uff0c\u7576\u8981\u958b\u59cb\u5f15\u8ff0\u4e00\u53e5\u8a71\u6642\u8981\u7528 \uff0c\u800c\u7d50\u675f\u5f15\u8ff0\u6642\u8981\u7528 &#8221; \u3002\u4e0d\u7528\u64d4\u5fc3\u6703\u6709\u591a\u5c64\u5de2\u72c0\u5f15\u865f\u7684\u60c5\u5f62\uff0c\u4e5f\u5c31\u662f\u7b2c\u4e00\u500b\u5f15\u865f\u4e00\u5b9a\u662f\u7528 \u4f86\u4ee3\u66ff\uff0c\u518d\u4f86\u7528 &#8221;\uff0c\u7136\u5f8c\u7528 &#8220; \uff0c\u63a5\u8457\u7528 &#8221; \uff0c\u4f9d\u6b64\u985e\u63a8\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><strong>EOF<\/strong> \u8f38\u5165\uff0c\u6bcf\u7b46\u8cc7\u6599\u6709\u4e00\u500b\u5305\u542b\u7a7a\u683c\u5b57\u5143\u7684\u5b57\u4e32\u3002<br>\u8f38\u51fa\u7684\u6587\u5b57\u5fc5\u9808\u548c\u8f38\u5165\u7684\u4e00\u6a21\u4e00\u6a23\uff0c\u9664\u4e86\uff1a<br>\u6bcf\u4e00\u7d44\u96d9\u5f15\u865f\u7684\u7b2c\u4e00\u500b &#8221; \u5fc5\u9808\u7528\u5169\u500b ` \u5b57\u5143\uff08\u5c31\u662f &#8220; \uff09\u4f86\u4ee3\u66ff<br>\u6bcf\u4e00\u7d44\u96d9\u5f15\u865f\u7684\u7b2c\u4e8c\u500b &#8221; \u5fc5\u9808\u7528\u5169\u500b &#8216; \u5b57\u5143\uff08 \u5c31\u662f &#8221;\uff09\u4f86\u4ee3\u66ff\u3002<\/td><td>\u8f38\u51fa\u66f4\u65b0\u5f8c\u7684\u5b57\u4e32\u3002<\/td><\/tr><tr><td>&#8220;To be or not to be,&#8221; quoth the Bard, &#8220;that<br>is the question&#8221;.<br>The programming contestant replied: &#8220;I must disagree.<br>To <code>C' or not to<\/code>C&#8217;, that is The Question!&#8221;<\/td><td>&#8220;To be or not to be,&#8221; quoth the Bard, that<br>is the question&#8221;.<br>The programming contestant replied: &#8220;I must disagree. To `C&#8217; or not to `C&#8217;, that is The Question!&#8221;<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">ZeroJudge C007 \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 <strong>Getline<\/strong> <strong>\u4f86\u6536\u6bcf\u4e00\u500b\u5b57\u4e32<\/strong>\uff0c\u4e26\u4e14\u7528 <strong>For\u8ff4\u5708<\/strong> \u78ba\u8a8d\u6bcf\u4e00\u500b\u5b57\u5143\uff0c\u5982\u679c\u5224\u65b7\u5230\u76ee\u524d\u5b57\u5143\u70ba\u300c&#8221;\u300d\uff0c\u53ef\u4ee5<strong>\u5ba3\u544a\u4e00\u500b\u5e03\u6797\u503c\u9810\u8a2d\u70ba True<\/strong>\uff0c\u5982\u679c\u5e03\u6797\u503c\u70ba True\uff0c\u8f38\u51fa\u300c&#8220;\u300d\u4e26\u5c07\u5e03\u6797\u503c\u8a2d\u70ba False\uff0c\u5982\u679c\u5e03\u6797\u503c\u70ba False\uff0c\u8f38\u51fa\u300c&#8221;\u300d\u4e26\u5c07\u5e03\u6797\u503c\u8a2d\u70ba True\u3002<\/p>\n\n\n\n<p class=\"\"><strong>\u9700\u8981\u6ce8\u610f\u7684\u662f\u9019\u500b\u5e03\u6797\u503c\u8981\u5ba3\u544a\u5728 EOF \u7684\u5916\u9762\u3002<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=c007\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge C007: TeX Quotes<\/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    bool start = true;\n    while (getline(cin, str))\n    {\n        for (int i = 0; i&lt;str.length(); i++)\n        {\n            if (str[i] == &#39;&quot;&#39;)\n            {\n                if (start)\n                {\n                    cout &lt;&lt; &quot;``&quot;;\n                    start = false;\n                }\n                else\n                {\n                    cout &lt;&lt; &quot;&#39;&#39;&quot;;\n                    start = true;\n                }\n            }\n            else cout &lt;&lt; str[i];\n        }\n        cout &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge C007\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 00272 &#8211; TeX Quotes TeX \u662f\u4e00\u7a2e\u7531 Donald Knuth \u6240 [&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,34,9],"class_list":["post-484","post","type-post","status-publish","format-standard","hentry","category-uva","tag-8","tag-11","tag-34","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/484","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=484"}],"version-history":[{"count":2,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/484\/revisions"}],"predecessor-version":[{"id":486,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/484\/revisions\/486"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}