{"id":84150,"date":"2026-07-26T08:48:51","date_gmt":"2026-07-26T00:48:51","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/84150.html"},"modified":"2026-07-26T08:48:51","modified_gmt":"2026-07-26T00:48:51","slug":"2026-07-26%ef%bc%9a%e5%b0%86%e6%95%b0%e7%bb%84%e8%bd%ac%e6%8d%a2%e4%b8%ba%e4%ba%a4%e6%9b%bf%e8%b4%a8%e6%95%b0%e6%95%b0%e7%bb%84%e7%9a%84%e6%9c%80%e5%b0%91%e6%93%8d%e4%bd%9c%e6%ac%a1%e6%95%b0%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/84150.html","title":{"rendered":"2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d"},"content":{"rendered":"<p>2026-07-26&#xff1a;\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00&#xff0c;\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 nums&#xff0c;\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570&#xff0c;\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002<\/p>\n<p>\u89c4\u5f8b\u662f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d\u7f6e&#xff0c;\u6700\u7ec8\u7684\u503c\u5fc5\u987b\u662f\u8d28\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>\u6240\u6709\u7d22\u5f15\u4e3a\u5947\u6570\u7684\u4f4d\u7f6e&#xff0c;\u6700\u7ec8\u7684\u503c\u5fc5\u987b\u662f\u975e\u8d28\u6570\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u6bcf\u6b21\u64cd\u4f5c\u53ea\u80fd\u8ba9\u4efb\u610f\u4f4d\u7f6e\u7684\u5143\u7d20\u52a0 1\u3002<\/p>\n<p>\u76ee\u6807\u662f\u6c42\u51fa\u8ba9\u6574\u4e2a\u6570\u7ec4\u6ee1\u8db3\u8fd9\u4e2a\u6761\u4ef6\u6240\u9700\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002<\/p>\n<p>1 &lt;&#061; nums.length &lt;&#061; 100000\u3002<\/p>\n<p>1 &lt;&#061; nums[i] &lt;&#061; 100000\u3002<\/p>\n<p>\u8f93\u5165&#xff1a; nums &#061; [1,2,3,4]\u3002<\/p>\n<p>\u8f93\u51fa&#xff1a; 3\u3002<\/p>\n<p>\u89e3\u91ca&#xff1a;<\/p>\n<p>\u4e0b\u6807 0 \u5904\u7684\u5143\u7d20\u5fc5\u987b\u662f\u8d28\u6570\u3002\u5c06 nums[0] &#061; 1 \u589e\u52a0\u5230 2&#xff0c;\u4f7f\u7528 1 \u6b21\u64cd\u4f5c\u3002<\/p>\n<p>\u4e0b\u6807 1 \u5904\u7684\u5143\u7d20\u5fc5\u987b\u662f\u975e\u8d28\u6570\u3002\u5c06 nums[1] &#061; 2 \u589e\u52a0\u5230 4&#xff0c;\u4f7f\u7528 2 \u6b21\u64cd\u4f5c\u3002<\/p>\n<p>\u4e0b\u6807 2 \u5904\u7684\u5143\u7d20\u5df2\u7ecf\u662f\u8d28\u6570\u3002<\/p>\n<p>\u4e0b\u6807 3 \u5904\u7684\u5143\u7d20\u5df2\u7ecf\u662f\u975e\u8d28\u6570\u3002<\/p>\n<p>\u603b\u64cd\u4f5c\u6b21\u6570 &#061; 1 &#043; 2 &#061; 3\u3002<\/p>\n<p>\u9898\u76ee\u6765\u81ea\u529b\u62633896\u3002<\/p>\n<h2>\u5927\u4f53\u6b65\u9aa4\u5982\u4e0b&#xff1a;<\/h2>\n<h3>\u4e00\u3001\u8d28\u6570\u9884\u8ba1\u7b97\u9636\u6bb5<\/h3>\n<p>\u5728 init() \u51fd\u6570\u4e2d&#xff0c;\u4ee3\u7801\u9884\u5148\u6784\u5efa\u4e86\u4e00\u4e2a\u8d28\u6570\u6807\u8bb0\u6570\u7ec4 notPrime&#xff0c;\u957f\u5ea6\u4e3a 100_004\u3002<\/p>\n<li>\n<p>\u521d\u59cb\u5316\u6807\u8bb0\u6570\u7ec4<\/p>\n<ul>\n<li>notPrime[0] \u548c notPrime[1] \u88ab\u6807\u8bb0\u4e3a 1&#xff0c;\u56e0\u4e3a 0 \u548c 1 \u4e0d\u662f\u8d28\u6570\u3002<\/li>\n<li>\u5176\u4f59\u4f4d\u7f6e\u521d\u59cb\u4e3a 0&#xff0c;\u8868\u793a\u6682\u65f6\u8ba4\u4e3a\u662f\u8d28\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u57c3\u62c9\u6258\u8272\u5c3c\u7b5b\u6cd5<\/p>\n<ul>\n<li>\u4ece 2 \u5f00\u59cb\u904d\u5386&#xff0c;\u53ea\u8981 i * i &lt; mx&#xff08;\u5373 i &lt;&#061; 316 \u5de6\u53f3&#xff09;&#xff0c;\u68c0\u67e5 notPrime[i]\u3002<\/li>\n<li>\u5982\u679c notPrime[i] &#061;&#061; 0&#xff08;\u8bf4\u660e i \u662f\u8d28\u6570&#xff09;&#xff0c;\u5219\u5c06 i \u7684\u6240\u6709\u500d\u6570&#xff08;\u4ece i * i \u5f00\u59cb&#xff09;\u6807\u8bb0\u4e3a 1&#xff08;\u975e\u8d28\u6570&#xff09;\u3002<\/li>\n<li>\u7b5b\u9009\u5b8c\u6210\u540e&#xff0c;notPrime[p] &#061;&#061; 0 \u8868\u793a p \u662f\u8d28\u6570&#xff0c;notPrime[p] &#061;&#061; 1 \u8868\u793a p \u4e0d\u662f\u8d28\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<p>\u8fd9\u91cc\u7684\u6570\u7ec4\u5927\u5c0f\u53d6 100_004 \u662f\u56e0\u4e3a\u9898\u76ee\u4e2d\u5143\u7d20\u6700\u5927\u503c\u662f 100000&#xff0c;\u800c\u64cd\u4f5c\u662f\u4e0d\u65ad\u589e\u52a0\u6570\u503c&#xff0c;\u53ef\u80fd\u8d85\u51fa\u539f\u6700\u5927\u503c\u3002\u9009\u7528\u5927\u4e8e 1e5 \u7684\u4e0b\u4e00\u4e2a\u8d28\u6570 100003 \u518d\u52a0 1&#xff0c;\u786e\u4fdd\u5728\u589e\u52a0\u8fc7\u7a0b\u4e2d\u67e5\u8be2\u8d28\u6570\u5c5e\u6027\u65f6\u4e0d\u8d8a\u754c\u3002<\/p>\n<h3>\u4e8c\u3001\u4e3b\u5904\u7406\u8fc7\u7a0b minOperations<\/h3>\n<p>\u51fd\u6570\u904d\u5386\u8f93\u5165\u6570\u7ec4 nums&#xff0c;\u5bf9\u6bcf\u4e2a\u5143\u7d20\u6839\u636e\u5176\u7d22\u5f15\u7684\u5947\u5076\u6027\u8fdb\u884c\u4e0d\u540c\u5904\u7406&#xff0c;\u5e76\u7d2f\u52a0\u64cd\u4f5c\u6b21\u6570\u3002<\/p>\n<li>\n<p>\u904d\u5386\u6570\u7ec4<br \/>\n\u7528 for i, x :&#061; range nums \u540c\u65f6\u83b7\u53d6\u7d22\u5f15 i \u548c\u5bf9\u5e94\u7684\u503c x\u3002<\/p>\n<\/li>\n<li>\n<p>\u786e\u5b9a\u76ee\u6807\u6761\u4ef6<\/p>\n<ul>\n<li>\u5982\u679c i \u662f\u5076\u6570&#xff08;i % 2 &#061;&#061; 0&#xff09;&#xff0c;\u8981\u6c42\u8be5\u4f4d\u7f6e\u7684\u6700\u7ec8\u503c\u5fc5\u987b\u662f\u8d28\u6570&#xff0c;\u5373 notPrime[x] \u6700\u7ec8\u5e94\u8be5\u7b49\u4e8e 0\u3002<\/li>\n<li>\u5982\u679c i \u662f\u5947\u6570&#xff08;i % 2 &#061;&#061; 1&#xff09;&#xff0c;\u8981\u6c42\u8be5\u4f4d\u7f6e\u7684\u6700\u7ec8\u503c\u5fc5\u987b\u662f\u975e\u8d28\u6570&#xff0c;\u5373 notPrime[x] \u6700\u7ec8\u5e94\u8be5\u7b49\u4e8e 1\u3002<\/li>\n<\/ul>\n<p>\u7528 i % 2 \u6b63\u597d\u53ef\u4ee5\u8868\u8fbe\u8fd9\u4e2a\u671f\u671b\u503c&#xff1a;<\/p>\n<ul>\n<li>\u5076\u6570\u7d22\u5f15\u671f\u671b notPrime[x] &#061;&#061; 0<\/li>\n<li>\u5947\u6570\u7d22\u5f15\u671f\u671b notPrime[x] &#061;&#061; 1<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5185\u5c42\u5faa\u73af\u9012\u589e<br \/>\n\u5bf9\u4e8e\u5f53\u524d\u4f4d\u7f6e\u7684\u6570\u503c x&#xff0c;\u68c0\u67e5 notPrime[x] \u662f\u5426\u7b49\u4e8e i % 2&#xff1a;<\/p>\n<ul>\n<li>\u5982\u679c\u4e0d\u7b49&#xff1a;\u8bf4\u660e\u5f53\u524d\u503c\u4e0d\u6ee1\u8db3\u6761\u4ef6\u3002\u7531\u4e8e\u53ea\u80fd\u505a\u201c\u52a0 1\u201d\u64cd\u4f5c&#xff0c;\u4e8e\u662f\u5c06 x \u589e\u52a0 1&#xff0c;\u540c\u65f6\u64cd\u4f5c\u6b21\u6570 ans \u52a0 1&#xff0c;\u7136\u540e\u518d\u6b21\u5224\u65ad\u65b0 x \u662f\u5426\u6ee1\u8db3\u6761\u4ef6\u3002<\/li>\n<li>\u5faa\u73af\u7ec8\u6b62\u6761\u4ef6&#xff1a;\u5f53 notPrime[x] &#061;&#061; i % 2 \u65f6\u505c\u6b62&#xff0c;\u6b64\u65f6 x \u6ee1\u8db3\u8be5\u7d22\u5f15\u4f4d\u7f6e\u7684\u8981\u6c42&#xff08;\u5076\u6570\u7d22\u5f15\u65f6 x \u662f\u8d28\u6570&#xff0c;\u5947\u6570\u7d22\u5f15\u65f6 x \u662f\u975e\u8d28\u6570&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e2a\u5faa\u73af\u4fdd\u8bc1\u4e86\u6bcf\u4e2a\u5143\u7d20\u901a\u8fc7\u6700\u5c11\u6b21\u6570\u7684\u201c\u52a0 1\u201d\u64cd\u4f5c&#xff0c;\u8fbe\u5230\u79bb\u5b83\u6700\u8fd1\u7684\u4e00\u4e2a\u6ee1\u8db3\u6761\u4ef6\u7684\u503c&#xff08;\u5411\u4e0a\u641c\u7d22\u7b2c\u4e00\u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u6570&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u7d2f\u52a0\u7ed3\u679c<br \/>\n\u6bcf\u5904\u7406\u5b8c\u4e00\u4e2a\u5143\u7d20&#xff0c;\u5176\u6240\u9700\u7684\u64cd\u4f5c\u6b21\u6570\u5df2\u7ecf\u7d2f\u52a0\u5230 ans \u4e2d\u3002\u904d\u5386\u7ed3\u675f\u540e&#xff0c;ans \u5c31\u662f\u6574\u4e2a\u6570\u7ec4\u53d8\u4e3a\u4ea4\u66ff\u8d28\u6570\/\u975e\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u603b\u64cd\u4f5c\u6b21\u6570\u3002<\/p>\n<\/li>\n<h3>\u4e09\u3001\u793a\u4f8b\u6267\u884c\u8fc7\u7a0b<\/h3>\n<p>\u4ee5 nums &#061; [1, 2, 3, 4] \u4e3a\u4f8b&#xff1a;<\/p>\n<ul>\n<li>i&#061;0&#xff08;\u5076\u6570&#xff0c;\u671f\u671b\u8d28\u6570&#xff09;&#xff1a;x&#061;1&#xff0c;notPrime[1] &#061;&#061; 1 \u2260 0&#xff0c;\u9012\u589e\u5230 2&#xff08;\u8d28\u6570&#xff09;&#xff0c;\u64cd\u4f5c &#043;1\u3002<\/li>\n<li>i&#061;1&#xff08;\u5947\u6570&#xff0c;\u671f\u671b\u975e\u8d28\u6570&#xff09;&#xff1a;x&#061;2&#xff0c;notPrime[2] &#061;&#061; 0 \u2260 1&#xff0c;\u9012\u589e\u5230 3&#xff08;\u8d28\u6570&#xff0c;\u64cd\u4f5c &#043;1&#xff0c;\u4ecd\u4e0d\u6ee1\u8db3&#xff09;&#xff0c;\u9012\u589e\u5230 4&#xff08;\u975e\u8d28\u6570&#xff0c;\u64cd\u4f5c &#043;1&#xff09;&#xff0c;\u5171 &#043;2\u3002<\/li>\n<li>i&#061;2&#xff08;\u5076\u6570&#xff0c;\u671f\u671b\u8d28\u6570&#xff09;&#xff1a;x&#061;3&#xff0c;notPrime[3] &#061;&#061; 0 &#061;&#061; 0&#xff0c;\u5df2\u6ee1\u8db3&#xff0c;\u64cd\u4f5c &#043;0\u3002<\/li>\n<li>i&#061;3&#xff08;\u5947\u6570&#xff0c;\u671f\u671b\u975e\u8d28\u6570&#xff09;&#xff1a;x&#061;4&#xff0c;notPrime[4] &#061;&#061; 1 &#061;&#061; 1&#xff0c;\u5df2\u6ee1\u8db3&#xff0c;\u64cd\u4f5c &#043;0\u3002<\/li>\n<\/ul>\n<p>\u603b\u64cd\u4f5c\u6b21\u6570 &#061; 1 &#043; 2 &#043; 0 &#043; 0 &#061; 3\u3002<\/p>\n<h3>\u56db\u3001\u65f6\u95f4\u590d\u6742\u5ea6\u5206\u6790<\/h3>\n<li>\n<p>\u8d28\u6570\u9884\u8ba1\u7b97<br \/>\n\u57c3\u6c0f\u7b5b\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(M log log M)&#xff0c;\u5176\u4e2d M &#061; 100004\u3002\u8fd9\u662f\u4e00\u4e2a\u5e38\u6570\u4e0a\u9650&#xff0c;\u6240\u4ee5\u662f O(1)\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e3b\u5faa\u73af<br \/>\n\u5bf9\u6570\u7ec4\u4e2d\u6bcf\u4e2a\u5143\u7d20&#xff0c;\u5185\u5c42\u7684 for \u5faa\u73af\u4f1a\u8ba9 x \u9012\u589e&#xff0c;\u76f4\u5230\u627e\u5230\u7b26\u5408\u6761\u4ef6\u7684\u503c\u3002\u5728\u6700\u574f\u60c5\u51b5\u4e0b&#xff0c;\u6bcf\u6b21\u53ef\u80fd\u8de8\u8d8a\u591a\u4e2a\u6570&#xff0c;\u4f46\u6bcf\u4e2a\u6570\u6700\u591a\u9012\u589e\u5230\u4e0b\u4e00\u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u503c&#xff0c;\u800c\u8d28\u6570\u548c\u975e\u8d28\u6570\u7684\u95f4\u9694\u662f\u6709\u9650\u7684\u3002\u7531\u4e8e\u8d28\u6570\u5206\u5e03\u76f8\u5bf9\u5bc6\u96c6&#xff08;\u5728 1e5 \u8303\u56f4\u5185\u6700\u5927\u95f4\u9694\u4e0d\u8d85\u8fc7\u51e0\u767e&#xff09;&#xff0c;\u5b9e\u9645\u4e0a\u5185\u5c42\u5faa\u73af\u6267\u884c\u6b21\u6570\u4e0e\u6570\u7ec4\u957f\u5ea6 n \u6210\u7ebf\u6027\u5173\u7cfb&#xff0c;\u603b\u4f53\u53ef\u4ee5\u8ba4\u4e3a\u662f O(n)\u3002<\/p>\n<p>\u5982\u679c\u4e25\u683c\u5206\u6790&#xff0c;\u6bcf\u4e2a\u4f4d\u7f6e\u7684\u64cd\u4f5c\u6b21\u6570\u7b49\u4e8e\u201c\u5230\u8fbe\u4e0b\u4e00\u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u6570\u7684\u8ddd\u79bb\u201d&#xff0c;\u6240\u6709\u8ddd\u79bb\u4e4b\u548c\u4e0d\u4f1a\u8d85\u8fc7\u67d0\u4e2a\u5e38\u6570\u4e58\u4ee5 n&#xff08;\u56e0\u4e3a\u6570\u503c\u8303\u56f4\u6709\u9650&#xff0c;\u8d28\u6570\u95f4\u9699\u6709\u754c&#xff09;&#xff0c;\u56e0\u6b64\u4ecd\u662f O(n)\u3002<\/p>\n<\/li>\n<p>\u603b\u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n)&#xff0c;\u5176\u4e2d n \u662f\u6570\u7ec4\u957f\u5ea6\u3002<\/p>\n<h3>\u4e94\u3001\u7a7a\u95f4\u590d\u6742\u5ea6\u5206\u6790<\/h3>\n<li>\n<p>notPrime \u6570\u7ec4<br \/>\n\u5927\u5c0f\u4e3a 100004 \u7684\u6574\u578b\u6570\u7ec4&#xff0c;\u5360\u7528\u5e38\u6570\u7ea7\u989d\u5916\u7a7a\u95f4&#xff0c;O(1)\u3002<\/p>\n<\/li>\n<li>\n<p>\u5176\u4ed6\u53d8\u91cf<br \/>\n\u53ea\u7528\u4e86\u51e0\u4e2a\u6574\u578b\u53d8\u91cf&#xff08;i, x, ans \u7b49&#xff09;&#xff0c;O(1)\u3002<\/p>\n<\/li>\n<p>\u603b\u989d\u5916\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(1)\u3002<\/p>\n<h2>Go\u5b8c\u6574\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/h2>\n<p><span class=\"token keyword\">package<\/span> main<\/p>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token punctuation\">(<\/span><br \/>\n<span class=\"token string\">&#034;fmt&#034;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">const<\/span> mx <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100_004<\/span> <span class=\"token comment\">\/\/ 1e5 \u7684\u4e0b\u4e00\u4e2a\u8d28\u6570\u662f 1e5 &#043; 3<\/span><br \/>\n<span class=\"token keyword\">var<\/span> notPrime <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span>mx<span class=\"token punctuation\">]<\/span><span class=\"token builtin\">int<\/span><span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">func<\/span> <span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">for<\/span> i <span class=\"token operator\">:&#061;<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">*<\/span>i <span class=\"token operator\">&lt;<\/span> mx<span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">if<\/span> notPrime<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">for<\/span> j <span class=\"token operator\">:&#061;<\/span> i <span class=\"token operator\">*<\/span> i<span class=\"token punctuation\">;<\/span> j <span class=\"token operator\">&lt;<\/span> mx<span class=\"token punctuation\">;<\/span> j <span class=\"token operator\">&#043;&#061;<\/span> i <span class=\"token punctuation\">{<\/span><br \/>\nnotPrime<span class=\"token punctuation\">[<\/span>j<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">func<\/span> <span class=\"token function\">minOperations<\/span><span class=\"token punctuation\">(<\/span>nums <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">(<\/span>ans <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">for<\/span> i<span class=\"token punctuation\">,<\/span> x <span class=\"token operator\">:&#061;<\/span> <span class=\"token keyword\">range<\/span> nums <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token comment\">\/\/ \u5982\u679c i \u662f\u5076\u6570&#xff0c;\u90a3\u4e48\u5faa\u73af\u76f4\u5230 notPrime[x] &#061;&#061; 0&#xff08;x \u662f\u8d28\u6570&#xff09;<\/span><br \/>\n<span class=\"token comment\">\/\/ \u5982\u679c i \u662f\u5947\u6570&#xff0c;\u90a3\u4e48\u5faa\u73af\u76f4\u5230 notPrime[x] &#061;&#061; 1&#xff08;x \u4e0d\u662f\u8d28\u6570&#xff09;<\/span><br \/>\n<span class=\"token keyword\">for<\/span> notPrime<span class=\"token punctuation\">[<\/span>x<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">!&#061;<\/span> i<span class=\"token operator\">%<\/span><span class=\"token number\">2<\/span> <span class=\"token punctuation\">{<\/span><br \/>\nans<span class=\"token operator\">&#043;&#043;<\/span><br \/>\nx<span class=\"token operator\">&#043;&#043;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">return<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">func<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\nnums <span class=\"token operator\">:&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">int<\/span><span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">4<\/span><span class=\"token punctuation\">}<\/span><br \/>\nresult <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">minOperations<\/span><span class=\"token punctuation\">(<\/span>nums<span class=\"token punctuation\">)<\/span><br \/>\nfmt<span class=\"token punctuation\">.<\/span><span class=\"token function\">Println<\/span><span class=\"token punctuation\">(<\/span>result<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726004849-6a655971f2149.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h2>Python\u5b8c\u6574\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/h2>\n<p><span class=\"token comment\"># -*-coding:utf-8-*-<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">min_operations<\/span><span class=\"token punctuation\">(<\/span>nums<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    mx <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100004<\/span>  <span class=\"token comment\"># 1e5 \u7684\u4e0b\u4e00\u4e2a\u8d28\u6570\u662f 1e5 &#043; 3<\/span><br \/>\n    not_prime <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">*<\/span> mx<br \/>\n    not_prime<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> not_prime<span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><\/p>\n<p>    <span class=\"token comment\"># \u57c3\u6c0f\u7b5b\u6807\u8bb0\u975e\u8d28\u6570<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> i <span class=\"token keyword\">in<\/span> <span class=\"token builtin\">range<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">(<\/span>mx <span class=\"token operator\">**<\/span> <span class=\"token number\">0.5<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> not_prime<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">for<\/span> j <span class=\"token keyword\">in<\/span> <span class=\"token builtin\">range<\/span><span class=\"token punctuation\">(<\/span>i <span class=\"token operator\">*<\/span> i<span class=\"token punctuation\">,<\/span> mx<span class=\"token punctuation\">,<\/span> i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n                not_prime<span class=\"token punctuation\">[<\/span>j<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><\/p>\n<p>    ans <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> i<span class=\"token punctuation\">,<\/span> x <span class=\"token keyword\">in<\/span> <span class=\"token builtin\">enumerate<\/span><span class=\"token punctuation\">(<\/span>nums<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token comment\"># \u5982\u679c i \u662f\u5076\u6570&#xff0c;\u9700\u8981 not_prime[x] &#061;&#061; 0&#xff08;x \u662f\u8d28\u6570&#xff09;<\/span><br \/>\n        <span class=\"token comment\"># \u5982\u679c i \u662f\u5947\u6570&#xff0c;\u9700\u8981 not_prime[x] &#061;&#061; 1&#xff08;x \u4e0d\u662f\u8d28\u6570&#xff09;<\/span><br \/>\n        <span class=\"token keyword\">while<\/span> not_prime<span class=\"token punctuation\">[<\/span>x<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">!&#061;<\/span> i <span class=\"token operator\">%<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            ans <span class=\"token operator\">&#043;&#061;<\/span> <span class=\"token number\">1<\/span><br \/>\n            x <span class=\"token operator\">&#043;&#061;<\/span> <span class=\"token number\">1<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> ans<\/p>\n<p><span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;__main__&#034;<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    nums <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">4<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    result <span class=\"token operator\">&#061;<\/span> min_operations<span class=\"token punctuation\">(<\/span>nums<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>result<span class=\"token punctuation\">)<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726004850-6a6559723c76c.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h2>C&#043;&#043;\u5b8c\u6574\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/h2>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;iostream&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;vector&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token keyword\">namespace<\/span> std<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">const<\/span> <span class=\"token keyword\">int<\/span> mx <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100004<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ 1e5 \u7684\u4e0b\u4e00\u4e2a\u8d28\u6570\u662f 1e5 &#043; 3<\/span><br \/>\n<span class=\"token keyword\">int<\/span> notPrime<span class=\"token punctuation\">[<\/span>mx<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u521d\u59cb\u5316\u57c3\u6c0f\u7b5b<\/span><br \/>\n<span class=\"token keyword\">void<\/span> <span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">*<\/span> i <span class=\"token operator\">&lt;<\/span> mx<span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>notPrime<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> j <span class=\"token operator\">&#061;<\/span> i <span class=\"token operator\">*<\/span> i<span class=\"token punctuation\">;<\/span> j <span class=\"token operator\">&lt;<\/span> mx<span class=\"token punctuation\">;<\/span> j <span class=\"token operator\">&#043;&#061;<\/span> i<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                notPrime<span class=\"token punctuation\">[<\/span>j<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">minOperations<\/span><span class=\"token punctuation\">(<\/span>vector<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">int<\/span><span class=\"token operator\">&gt;<\/span><span class=\"token operator\">&amp;<\/span> nums<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> ans <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> nums<span class=\"token punctuation\">.<\/span><span class=\"token function\">size<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">int<\/span> x <span class=\"token operator\">&#061;<\/span> nums<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u5982\u679c i \u662f\u5076\u6570&#xff0c;\u9700\u8981 notPrime[x] &#061;&#061; 0&#xff08;x \u662f\u8d28\u6570&#xff09;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u5982\u679c i \u662f\u5947\u6570&#xff0c;\u9700\u8981 notPrime[x] &#061;&#061; 1&#xff08;x \u4e0d\u662f\u8d28\u6570&#xff09;<\/span><br \/>\n        <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span>notPrime<span class=\"token punctuation\">[<\/span>x<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">!&#061;<\/span> i <span class=\"token operator\">%<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            ans<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            x<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> ans<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u521d\u59cb\u5316\u8d28\u6570\u8868<\/span><br \/>\n    vector<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">int<\/span><span class=\"token operator\">&gt;<\/span> nums <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">4<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> result <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">minOperations<\/span><span class=\"token punctuation\">(<\/span>nums<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    cout <span class=\"token operator\">&lt;&lt;<\/span> result <span class=\"token operator\">&lt;&lt;<\/span> endl<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726004850-6a65597257415.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2026-07-26&#xff1a;\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00&#xff0c;\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 nums&#xff0c;\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570&#xff0c;\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002<br \/>\n\u89c4\u5f8b\u662f&#xff1a;\u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d\u7f6e&#xff0c;\u6700\u7ec8\u7684\u503c\u5fc5\u987b\u662f\u8d28\u6570\u3002\u6240\u6709\u7d22\u5f15\u4e3a\u5947\u6570\u7684\u4f4d\u7f6e&#xff0c;\u6700\u7ec8\u7684\u503c\u5fc5\u987b\u662f\u975e\u8d28\u6570\u3002\u6bcf\u6b21\u64cd\u4f5c\u53ea\u80fd\u8ba9\u4efb\u610f\u4f4d\u7f6e\u7684\u5143\u7d20\u52a0 1\u3002<br \/>\n\u76ee\u6807\u662f\u6c42\u51fa\u8ba9\u6574\u4e2a\u6570\u7ec4\u6ee1\u8db3\u8fd9\u4e2a\u6761\u4ef6\u6240\u9700\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002<br \/>\n1 &lt; nums.length <\/p>\n","protected":false},"author":2,"featured_media":84147,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9137,427],"topic":[],"class_list":["post-84150","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-atomgit","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/84150.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"2026-07-26&#xff1a;\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00&#xff0c;\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 nums&#xff0c;\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570&#xff0c;\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f&#xff1a;\u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d\u7f6e&#xff0c;\u6700\u7ec8\u7684\u503c\u5fc5\u987b\u662f\u8d28\u6570\u3002\u6240\u6709\u7d22\u5f15\u4e3a\u5947\u6570\u7684\u4f4d\u7f6e&#xff0c;\u6700\u7ec8\u7684\u503c\u5fc5\u987b\u662f\u975e\u8d28\u6570\u3002\u6bcf\u6b21\u64cd\u4f5c\u53ea\u80fd\u8ba9\u4efb\u610f\u4f4d\u7f6e\u7684\u5143\u7d20\u52a0 1\u3002 \u76ee\u6807\u662f\u6c42\u51fa\u8ba9\u6574\u4e2a\u6570\u7ec4\u6ee1\u8db3\u8fd9\u4e2a\u6761\u4ef6\u6240\u9700\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002 1 &lt; nums.length\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/84150.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-26T00:48:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726004849-6a655971f2149.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84150.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/84150.html\",\"name\":\"2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-26T00:48:51+00:00\",\"dateModified\":\"2026-07-26T00:48:51+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/84150.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/84150.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84150.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/84150.html","og_locale":"zh_CN","og_type":"article","og_title":"2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"2026-07-26&#xff1a;\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00&#xff0c;\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 nums&#xff0c;\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570&#xff0c;\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f&#xff1a;\u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d\u7f6e&#xff0c;\u6700\u7ec8\u7684\u503c\u5fc5\u987b\u662f\u8d28\u6570\u3002\u6240\u6709\u7d22\u5f15\u4e3a\u5947\u6570\u7684\u4f4d\u7f6e&#xff0c;\u6700\u7ec8\u7684\u503c\u5fc5\u987b\u662f\u975e\u8d28\u6570\u3002\u6bcf\u6b21\u64cd\u4f5c\u53ea\u80fd\u8ba9\u4efb\u610f\u4f4d\u7f6e\u7684\u5143\u7d20\u52a0 1\u3002 \u76ee\u6807\u662f\u6c42\u51fa\u8ba9\u6574\u4e2a\u6570\u7ec4\u6ee1\u8db3\u8fd9\u4e2a\u6761\u4ef6\u6240\u9700\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002 1 &lt; nums.length","og_url":"https:\/\/www.wsisp.com\/helps\/84150.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-26T00:48:51+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726004849-6a655971f2149.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/84150.html","url":"https:\/\/www.wsisp.com\/helps\/84150.html","name":"2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-26T00:48:51+00:00","dateModified":"2026-07-26T00:48:51+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/84150.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/84150.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/84150.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"2026-07-26\uff1a\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u4ea4\u66ff\u8d28\u6570\u6570\u7ec4\u7684\u6700\u5c11\u64cd\u4f5c\u6b21\u6570\u3002\u7528go\u8bed\u8a00\uff0c\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 `nums`\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u6700\u5c11\u7684\u64cd\u4f5c\u6b21\u6570\uff0c\u628a\u5b83\u53d8\u6210\u6ee1\u8db3\u7279\u5b9a\u89c4\u5f8b\u7684\u6570\u7ec4\u3002 \u89c4\u5f8b\u662f\uff1a - \u6570\u7ec4\u4e2d\u6240\u6709\u7d22\u5f15\u4e3a\u5076\u6570\u7684\u4f4d"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=84150"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84150\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/84147"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=84150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=84150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=84150"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=84150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}