{"id":571,"date":"2026-07-04T21:22:26","date_gmt":"2026-07-04T13:22:26","guid":{"rendered":"https:\/\/mitongxue.cn\/?p=571"},"modified":"2026-07-04T21:22:26","modified_gmt":"2026-07-04T13:22:26","slug":"hj20-%e5%af%86%e7%a0%81%e9%aa%8c%e8%af%81%e5%90%88%e6%a0%bc%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/mitongxue.cn\/index.php\/2026\/07\/04\/hj20-%e5%af%86%e7%a0%81%e9%aa%8c%e8%af%81%e5%90%88%e6%a0%bc%e7%a8%8b%e5%ba%8f\/","title":{"rendered":"HJ20.\u5bc6\u7801\u9a8c\u8bc1\u5408\u683c\u7a0b\u5e8f"},"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>\u4f60\u9700\u8981\u4e66\u5199\u4e00\u4e2a\u7a0b\u5e8f\u9a8c\u8bc1\u7ed9\u5b9a\u7684\u5bc6\u7801\u662f\u5426\u5408\u683c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u5408\u683c\u7684\u5bc6\u7801\u8981\u6c42\uff1a<br><math><semantics><mrow><mspace width=\"2.3000000000000003em\"><\/mspace><mo>\u2219<\/mo><mtext>\u2009<\/mtext><\/mrow><\/semantics><\/math>\u2219\u957f\u5ea6\u4e0d\u5c11\u4e8e&nbsp;<math><semantics><mrow><mn>8<\/mn><\/mrow><\/semantics><\/math>8&nbsp;\u4f4d<br><math><semantics><mrow><mspace width=\"2.3000000000000003em\"><\/mspace><mo>\u2219<\/mo><mtext>\u2009<\/mtext><\/mrow><\/semantics><\/math>\u2219\u5fc5\u987b\u5305\u542b\u5927\u5199\u5b57\u6bcd\u3001\u5c0f\u5199\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7279\u6b8a\u5b57\u7b26\u4e2d\u7684\u81f3\u5c11\u4e09\u79cd<br><math><semantics><mrow><mspace width=\"2.3000000000000003em\"><\/mspace><mo>\u2219<\/mo><mtext>\u2009<\/mtext><\/mrow><\/semantics><\/math>\u2219\u4e0d\u80fd\u5206\u5272\u51fa\u4e24\u4e2a\u72ec\u7acb\u7684\u3001\u957f\u5ea6\u5927\u4e8e&nbsp;<math><semantics><mrow><mn>2<\/mn><\/mrow><\/semantics><\/math>2&nbsp;\u7684\u8fde\u7eed\u5b50\u4e32\uff0c\u4f7f\u5f97\u8fd9\u4e24\u4e2a\u5b50\u4e32\u5b8c\u5168\u76f8\u540c\uff1b\u66f4\u5177\u4f53\u5730\uff0c\u5982\u679c\u5b58\u5728\u4e24\u4e2a\u957f\u5ea6\u5927\u4e8e&nbsp;<math><semantics><mrow><mn>2<\/mn><\/mrow><\/semantics><\/math>2&nbsp;\u7684\u72ec\u7acb\u5b50\u4e32&nbsp;<math><semantics><mrow><msub><mi>s<\/mi><mn>1<\/mn><\/msub><mo separator=\"true\">,<\/mo><msub><mi>s<\/mi><mn>2<\/mn><\/msub><\/mrow><\/semantics><\/math><em>s<\/em>1\u200b,<em>s<\/em>2\u200b&nbsp;\uff0c\u4f7f\u5f97&nbsp;<math><semantics><mrow><msub><mi>s<\/mi><mn>1<\/mn><\/msub><mo>=<\/mo><msub><mi>s<\/mi><mn>2<\/mn><\/msub><\/mrow><\/semantics><\/math><em>s<\/em>1\u200b=<em>s<\/em>2\u200b&nbsp;\uff0c\u90a3\u4e48\u5bc6\u7801\u4e0d\u5408\u6cd5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u5b50\u4e32\u4e3a\u4ece\u539f\u5b57\u7b26\u4e32\u4e2d\uff0c\u8fde\u7eed\u7684\u9009\u62e9\u4e00\u6bb5\u5b57\u7b26\uff08\u53ef\u4ee5\u5168\u9009\u3001\u53ef\u4ee5\u4e0d\u9009\uff09\u5f97\u5230\u7684\u65b0\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u53ef\u89c1\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<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/uploadfiles.nowcoder.com\/images\/20241213\/0_1734082944014\/C6902880421461F52B199134D42A74DD\" alt=\"..\/\u56fe\u7247\/AllAscii.png\"\/><\/figure>\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>\u672c\u9898\u5c06\u4f1a\u7ed9\u51fa&nbsp;<math><semantics><mrow><mn>1<\/mn><mo>\u2266<\/mo><mi>T<\/mi><mo>\u2266<\/mo><mn>10<\/mn><\/mrow><\/semantics><\/math>1\u2266<em>T<\/em>\u226610&nbsp;\u7ec4\u6d4b\u8bd5\u6570\u636e\uff0c\u786e\u5207\u6570\u5b57\u672a\u77e5\uff0c\u60a8\u9700\u8981\u4e00\u76f4\u8bfb\u5165\u76f4\u5230\u6587\u4ef6\u7ed3\u5c3e\uff1b\u60a8\u4e5f\u53ef\u4ee5\u53c2\u8003&nbsp;<a href=\"https:\/\/www.nowcoder.com\/discuss\/353153846992117760\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>\u725b\u5ba2\u7f51\u5728\u7ebf\u5224\u9898\u7cfb\u7edf\u4f7f\u7528\u5e2e\u52a9<\/strong><\/a>&nbsp;\u83b7\u5f97\u66f4\u591a\u7684\u4f7f\u7528\u5e2e\u52a9\u3002\u6bcf\u7ec4\u6d4b\u8bd5\u6570\u636e\u63cf\u8ff0\u5982\u4e0b\uff1a<\/p>\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\u5165\u4e00\u4e2a\u957f\u5ea6\u4e3a&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>100<\/mn><\/mrow><\/semantics><\/math>1\u2266length(<em>s<\/em>)\u2266100&nbsp;\uff0c\u7531\u53ef\u89c1\u5b57\u7b26\u6784\u6210\u7684\u5b57\u7b26\u4e32&nbsp;<math><semantics><mrow><mi>s<\/mi><\/mrow><\/semantics><\/math><em>s<\/em>&nbsp;\uff0c\u4ee3\u8868\u5f85\u5224\u65ad\u7684\u5bc6\u7801\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>\u5bf9\u4e8e\u6bcf\u4e00\u7ec4\u6d4b\u8bd5\u6570\u636e\uff0c\u65b0\u8d77\u4e00\u884c\u3002\u82e5\u5bc6\u7801\u5408\u683c\uff0c\u8f93\u51fa&nbsp;<math><semantics><mrow><mtext>OK<\/mtext><\/mrow><\/semantics><\/math>OK&nbsp;\uff0c\u5426\u5219\u8f93\u51fa&nbsp;<math><semantics><mrow><mtext>NG<\/mtext><\/mrow><\/semantics><\/math>NG&nbsp;\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>021Abc9000\n021Abc9Abc1\n021ABC9000\n021$bc9000\n021Abc1111<\/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>OK\nNG\nNG\nOK\nOK<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf4\u660e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u5bf9\u4e8e\u7b2c\u4e8c\u7ec4\u6d4b\u8bd5\u6570\u636e\uff0c<math><semantics><mrow><mtext mathvariant=\"monospace\">\"<\/mtext><mstyle mathcolor=\"orange\"><mtext mathvariant=\"monospace\">Abc<\/mtext><\/mstyle><mtext mathvariant=\"monospace\">9<\/mtext><mstyle mathcolor=\"orange\"><mtext mathvariant=\"monospace\">Abc<\/mtext><\/mstyle><mtext mathvariant=\"monospace\">1\"<\/mtext><\/mrow><\/semantics><\/math>\"Abc9Abc1\" \u4e2d\u5b58\u5728\u4e24\u4e2a\u957f\u5ea6\u5927\u4e8e <math><semantics><mrow><mn>2<\/mn><\/mrow><\/semantics><\/math>2 \u7684\u72ec\u7acb\u5b50\u4e32 <math><semantics><mrow><mtext mathvariant=\"monospace\">\"Abc\"<\/mtext><\/mrow><\/semantics><\/math>\"Abc\" \uff0c\u5373\u6a59\u8272\u6807\u8bb0\u90e8\u5206\u3002<br><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u5bf9\u4e8e\u7b2c\u4e09\u7ec4\u6d4b\u8bd5\u6570\u636e\uff0c\u4ec5\u5305\u542b\u5927\u5199\u5b57\u6bcd\u548c\u6570\u5b57\uff0c\u4e0d\u6ee1\u8db3\u6761\u4ef6\u3002<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u793a\u4f8b2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u5165\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Abc1@\nA1@ababa@1A<\/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>NG\nOK<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf4\u660e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u5bf9\u4e8e\u7b2c\u4e00\u7ec4\u6d4b\u8bd5\u6570\u636e\uff0c\u957f\u5ea6\u4e0d\u8db3 <math><semantics><mrow><mn>8<\/mn><\/mrow><\/semantics><\/math>8 \u4f4d\uff0c\u4e0d\u6ee1\u8db3\u6761\u4ef6\u3002<\/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;\nconst childStr = (str)=>{\n    let map = new Map();\n    for(let i=0;i&lt;str.length;i++){\n        const temp = str.substring(i,i+3);\n        if(map.has(temp)){\n            const lastIndex = map.get(temp);\n            if(i>=lastIndex +3){\n                return true;\n            }\n        }else{\n            map.set(temp,i)\n        }\n    }\n    return false;\n}\nconst check=(str)=>{\n    if(str.length&lt;8){\n        return false;\n    }\n    let num = 0;\n    if(\/&#91;A-Z]+\/.test(str)){\n        num++;\n    }\n    if(\/&#91;a-z]+\/.test(str)){\n        num++;\n    }\n    if(\/\\d+\/.test(str)){\n        num++;\n    }\n    if(\/&#91;^A-Za-z0-9]\/.test(str)){\n        num++;\n    }\n    if(num&lt;3){\n        \/\/console.log(str,'lte 3');\n        return false;\n    }\n\n    if(childStr(str)){\n        \/\/console.log(str,'childStr');\n        return false;\n    }\n    return true;\n}\nvoid async function () {\n    \/\/ Write your code here\n    while(line = await readline()){\n        let tokens = line.trim();\n        if(check(tokens)){\n            console.log('OK');\n        }else{\n            console.log('NG');\n        }\n        \n    }\n}()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u91cd\u70b9\u5b50\u4e32\u68c0\u67e5\u65b9\u5f0f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const childStr = (str)=>{\n    let map = new Map();\n    for(let i=0;i&lt;str.length;i++){\n        <strong>const temp = str.substring(i,i+3);<\/strong>\n        if(map.has(temp)){\n            const lastIndex = map.get(temp);\n            <strong>if(i>=lastIndex +3){<\/strong>\n                return true;\n            }\n        }else{\n            map.set(temp,i)\n        }\n    }\n    return false;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63cf\u8ff0 \u4f60\u9700\u8981\u4e66\u5199\u4e00\u4e2a\u7a0b\u5e8f\u9a8c\u8bc1\u7ed9\u5b9a\u7684\u5bc6\u7801\u662f\u5426\u5408\u683c\u3002 ..<\/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-571","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\/571","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=571"}],"version-history":[{"count":1,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/571\/revisions"}],"predecessor-version":[{"id":572,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/571\/revisions\/572"}],"wp:attachment":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/media?parent=571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/categories?post=571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/tags?post=571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}