{"id":565,"date":"2026-07-04T11:26:50","date_gmt":"2026-07-04T03:26:50","guid":{"rendered":"https:\/\/mitongxue.cn\/?p=565"},"modified":"2026-07-04T11:26:50","modified_gmt":"2026-07-04T03:26:50","slug":"%e5%93%88%e5%b8%8c%e8%a1%a8%ef%bc%9ahj10-%e5%ad%97%e7%ac%a6%e4%b8%aa%e6%95%b0%e7%bb%9f%e8%ae%a1","status":"publish","type":"post","link":"https:\/\/mitongxue.cn\/index.php\/2026\/07\/04\/%e5%93%88%e5%b8%8c%e8%a1%a8%ef%bc%9ahj10-%e5%ad%97%e7%ac%a6%e4%b8%aa%e6%95%b0%e7%bb%9f%e8%ae%a1\/","title":{"rendered":"\u54c8\u5e0c\u8868\uff1aHJ10.\u5b57\u7b26\u4e2a\u6570\u7edf\u8ba1"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u63cf\u8ff0<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u5bf9\u4e8e\u7ed9\u5b9a\u7684\u5b57\u7b26\u4e32\uff0c\u7edf\u8ba1\u5176\u4e2d\u7684 ASCII \u7801\u5728&nbsp;<math><semantics><mrow><mn>0<\/mn><\/mrow><\/semantics><\/math>0&nbsp;\u5230&nbsp;<math><semantics><mrow><mn>127<\/mn><\/mrow><\/semantics><\/math>127&nbsp;\u8303\u56f4\u5185\u7684\u4e0d\u540c\u5b57\u7b26\u7684\u4e2a\u6570\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u5907\u6ce8\uff1a\u53d7\u9650\u4e8e\u8f93\u5165\uff0c\u672c\u9898\u5b9e\u9645\u8f93\u5165\u5b57\u7b26\u96c6\u4e3a ASCII \u7801\u5728&nbsp;<math><semantics><mrow><mn>33<\/mn><\/mrow><\/semantics><\/math>33&nbsp;\u5230&nbsp;<math><semantics><mrow><mn>126<\/mn><\/mrow><\/semantics><\/math>126&nbsp;\u8303\u56f4\u5185\u7684\u53ef\u89c1\u5b57\u7b26\u3002\u60a8\u53ef\u4ee5\u53c2\u9605\u4e0b\u8868\u83b7\u5f97\u5176\u8be6\u7ec6\u4fe1\u606f\uff08\u60a8\u53ef\u80fd\u5173\u6ce8\u7684\u5185\u5bb9\u662f\uff0c\u8fd9\u5176\u4e2d\u4e0d\u5305\u542b\u7a7a\u683c\u3001\u6362\u884c\uff09\u3002<br><br><img decoding=\"async\" src=\"https:\/\/uploadfiles.nowcoder.com\/images\/20241213\/0_1734082944014\/C6902880421461F52B199134D42A74DD\" alt=\"\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8f93\u5165\u63cf\u8ff0\uff1a<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u8f93\u5165\u4e00\u4e2a\u957f\u5ea6&nbsp;<math><semantics><mrow><mn>1<\/mn><mo>\u2266<\/mo><mrow><mi mathvariant=\"normal\">l<\/mi><mi mathvariant=\"normal\">e<\/mi><mi mathvariant=\"normal\">n<\/mi><mi mathvariant=\"normal\">g<\/mi><mi mathvariant=\"normal\">t<\/mi><mi mathvariant=\"normal\">h<\/mi><\/mrow><mo stretchy=\"false\">(<\/mo><mi>s<\/mi><mo stretchy=\"false\">)<\/mo><mo>\u2266<\/mo><mn>500<\/mn><\/mrow><\/semantics><\/math>1\u2266length(<em>s<\/em>)\u2266500\uff0c\u4ec5\u7531\u56fe\u7247\u4e2d\u7684\u53ef\u89c1\u5b57\u7b26\u6784\u6210\u7684\u5b57\u7b26\u4e32&nbsp;<math><semantics><mrow><mi>s<\/mi><\/mrow><\/semantics><\/math><em>s<\/em>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8f93\u51fa\u63cf\u8ff0\uff1a<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u5728\u4e00\u884c\u4e0a\u8f93\u51fa\u4e00\u4e2a\u6574\u6570\uff0c\u4ee3\u8868\u7ed9\u5b9a\u5b57\u7b26\u4e32\u4e2d ASCII \u7801\u5728&nbsp;<math><semantics><mrow><mn>0<\/mn><\/mrow><\/semantics><\/math>0&nbsp;\u5230&nbsp;<math><semantics><mrow><mn>127<\/mn><\/mrow><\/semantics><\/math>127&nbsp;\u8303\u56f4\u5185\u7684\u4e0d\u540c\u5b57\u7b26\u7684\u4e2a\u6570\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u793a\u4f8b1<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u5165\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;@A8aA].0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>8<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>const rl = require(\"readline\").createInterface({ input: process.stdin });\nvar iter = rl&#91;Symbol.asyncIterator]();\nconst readline = async () => (await iter.next()).value;\n\nvoid async function () {\n    \/\/ Write your code here\n    while(line = await readline()){\n        let set = new Set();\n        let tokens = line.split('');\n        for(let i=0;i&lt;tokens.length;i++){\n          \n            if(tokens&#91;i].charCodeAt()>=0 &amp;&amp; tokens&#91;i].charCodeAt()&lt;=127){\n                set.add(tokens&#91;i])\n            }\n        }\n        console.log(&#91;...set].length)\n        \n    }\n}()<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>void async function () {\n    \/\/ Write your code here\n    while(line = await readline()){\n        \n        let tokens = line.split('');\n        const newArray = tokens.filter(item=>item.charCodeAt()>=0 &amp;&amp; item.charCodeAt()&lt;=127)\n        const set = new Set(newArray);\n        console.log(&#91;...set].length)\n        \n    }\n}()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63cf\u8ff0 \u5bf9\u4e8e\u7ed9\u5b9a\u7684\u5b57\u7b26\u4e32\uff0c\u7edf\u8ba1\u5176\u4e2d\u7684 ASCII \u7801..<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,11,23],"tags":[],"class_list":["post-565","post","type-post","status-publish","format-standard","hentry","category-js","category-front","category-23"],"featured_image_urls":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"author_info":{"info":["\u9648 \u67d0\u4eba"]},"category_info":"<a href=\"https:\/\/mitongxue.cn\/index.php\/category\/front\/js\/\" rel=\"category tag\">JS<\/a> <a href=\"https:\/\/mitongxue.cn\/index.php\/category\/front\/\" rel=\"category tag\">\u524d\u7aef<\/a> <a href=\"https:\/\/mitongxue.cn\/index.php\/category\/front\/%e8%af%95%e9%a2%98\/\" rel=\"category tag\">\u8bd5\u9898<\/a>","tag_info":"\u8bd5\u9898","comment_count":"0","_links":{"self":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/comments?post=565"}],"version-history":[{"count":1,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/565\/revisions"}],"predecessor-version":[{"id":566,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/565\/revisions\/566"}],"wp:attachment":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/media?parent=565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/categories?post=565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/tags?post=565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}