{"id":563,"date":"2026-07-04T10:45:24","date_gmt":"2026-07-04T02:45:24","guid":{"rendered":"https:\/\/mitongxue.cn\/?p=563"},"modified":"2026-07-04T10:45:24","modified_gmt":"2026-07-04T02:45:24","slug":"%e5%bf%ab%e9%80%9f%e6%8e%92%e5%ba%8f-hj3-%e6%98%8e%e6%98%8e%e7%9a%84%e9%9a%8f%e6%9c%ba%e6%95%b0","status":"publish","type":"post","link":"https:\/\/mitongxue.cn\/index.php\/2026\/07\/04\/%e5%bf%ab%e9%80%9f%e6%8e%92%e5%ba%8f-hj3-%e6%98%8e%e6%98%8e%e7%9a%84%e9%9a%8f%e6%9c%ba%e6%95%b0\/","title":{"rendered":"\u5feb\u901f\u6392\u5e8f-HJ3\u00a0\u660e\u660e\u7684\u968f\u673a\u6570"},"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\u660e\u660e\u751f\u6210\u7684&nbsp;<math><semantics><mrow><mi>n<\/mi><\/mrow><\/semantics><\/math><em>n<\/em>&nbsp;\u4e2a&nbsp;<math><semantics><mrow><mn>1<\/mn><\/mrow><\/semantics><\/math>1&nbsp;\u5230&nbsp;<math><semantics><mrow><mn>500<\/mn><\/mrow><\/semantics><\/math>500&nbsp;\u4e4b\u95f4\u7684\u968f\u673a\u6574\u6570\uff0c\u4f60\u9700\u8981\u5e2e\u52a9\u4ed6\u5b8c\u6210\u4ee5\u4e0b\u4efb\u52a1\uff1a<br><math><semantics><mrow><mspace width=\"2.3000000000000003em\"><\/mspace><mo>\u2219<\/mo><mtext>\u2009<\/mtext><\/mrow><\/semantics><\/math>\u2219\u5220\u53bb\u91cd\u590d\u7684\u6570\u5b57\uff0c\u5373\u76f8\u540c\u7684\u6570\u5b57\u53ea\u4fdd\u7559\u4e00\u4e2a\uff0c\u628a\u5176\u4f59\u76f8\u540c\u7684\u6570\u53bb\u6389\uff1b<br><math><semantics><mrow><mspace width=\"2.3000000000000003em\"><\/mspace><mo>\u2219<\/mo><mtext>\u2009<\/mtext><\/mrow><\/semantics><\/math>\u2219\u7136\u540e\u518d\u628a\u8fd9\u4e9b\u6570\u4ece\u5c0f\u5230\u5927\u6392\u5e8f\uff0c\u6309\u7167\u6392\u597d\u7684\u987a\u5e8f\u8f93\u51fa\u3002<br><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u4f60\u53ea\u9700\u8981\u8f93\u51fa\u6700\u7ec8\u7684\u6392\u5e8f\u7ed3\u679c\u3002<\/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>\u7b2c\u4e00\u884c\u8f93\u5165\u4e00\u4e2a\u6574\u6570&nbsp;<math><semantics><mrow><mi>n<\/mi><mtext>&nbsp;<\/mtext><mo stretchy=\"false\">(<\/mo><mn>1<\/mn><mo>\u2266<\/mo><mi>n<\/mi><mo>\u2266<\/mo><mn>1000<\/mn><mo stretchy=\"false\">)<\/mo><\/mrow><\/semantics><\/math><em>n<\/em>&nbsp;(1\u2266<em>n<\/em>\u22661000)\uff0c\u4ee3\u8868\u660e\u660e\u751f\u6210\u7684\u6570\u5b57\u4e2a\u6570\u3002<br><math><semantics><mrow><mspace width=\"1.5em\"><\/mspace><\/mrow><\/semantics><\/math>\u6b64\u540e&nbsp;<math><semantics><mrow><mi>n<\/mi><\/mrow><\/semantics><\/math><em>n<\/em>&nbsp;\u884c\uff0c\u7b2c&nbsp;<math><semantics><mrow><mi>i<\/mi><\/mrow><\/semantics><\/math><em>i<\/em>&nbsp;\u884c\u8f93\u5165\u4e00\u4e2a\u6574\u6570&nbsp;<math><semantics><mrow><msub><mi>a<\/mi><mi>i<\/mi><\/msub><mtext>&nbsp;<\/mtext><mo stretchy=\"false\">(<\/mo><mn>1<\/mn><mo>\u2266<\/mo><msub><mi>a<\/mi><mi>i<\/mi><\/msub><mo>\u2266<\/mo><mn>500<\/mn><mo stretchy=\"false\">)<\/mo><\/mrow><\/semantics><\/math><em>a<\/em><em>i<\/em>\u200b&nbsp;(1\u2266<em>a<\/em><em>i<\/em>\u200b\u2266500)\uff0c\u4ee3\u8868\u660e\u660e\u751f\u6210\u7684\u968f\u673a\u6574\u6570\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>\u8f93\u51fa\u82e5\u5e72\u884c\uff0c\u6bcf\u884c\u8f93\u51fa\u4e00\u4e2a\u6574\u6570\uff0c\u4ee3\u8868\u8f93\u5165\u6570\u636e\u6392\u5e8f\u540e\u7684\u7ed3\u679c\u3002\u7b2c\u4e00\u884c\u8f93\u51fa\u6700\u5c0f\u7684\u6570\u5b57\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>3\n2\n2\n1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u590d\u5236<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1\n2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\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    let oriSet = new Set();\n    let i = 0;\n    const n = line = await readline();\n    while(line = await readline()){\n        if(i>n){\n            break;\n        }\n        let tokens = line.trim();\n        oriSet.add(tokens*1)\n        i++;\n    }\n    const newArray = &#91;...oriSet].sort((a,b)=>a-b).forEach(v=>console.log(v));\n    \n}()<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>    let count;\n    count = parseInt(await readline());\n    let nums = &#91;];\n    for (let i = 1; i &lt;= count; ++i) {\n        let n;\n        n = parseInt(await readline());\n        if (!nums.includes(n)) {\n            nums.push(n);\n        }\n    }\n    nums.sort((a, b) => a - b).forEach(c=>{\n        console.log(c)\n    });<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63cf\u8ff0 \u5bf9\u4e8e\u660e\u660e\u751f\u6210\u7684&nbsp;nn&nbsp;\u4e2a..<\/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":[48],"class_list":["post-563","post","type-post","status-publish","format-standard","hentry","category-js","category-front","category-23","tag-48"],"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\/563","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=563"}],"version-history":[{"count":1,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/563\/revisions"}],"predecessor-version":[{"id":564,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/563\/revisions\/564"}],"wp:attachment":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/media?parent=563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/categories?post=563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/tags?post=563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}