{"id":134,"date":"2017-04-03T20:44:00","date_gmt":"2017-04-03T12:44:00","guid":{"rendered":"https:\/\/cn1.club\/?p=134"},"modified":"2025-03-13T20:09:48","modified_gmt":"2025-03-13T12:09:48","slug":"%e7%bb%83%e4%b9%a0%e7%94%9f%e6%88%90%e9%9a%8f%e6%9c%ba%e6%95%b0%e5%b9%b6%e7%94%a8%e8%bf%ad%e4%bb%a3%e5%99%a8%e9%81%8d%e5%8e%86%e9%9b%86%e5%90%88%e5%85%83%e7%b4%a0%e5%b9%b6%e8%be%93%e5%87%ba","status":"publish","type":"post","link":"https:\/\/cn1.club\/?p=134","title":{"rendered":"[\u7ec3\u4e60]\u751f\u6210\u968f\u673a\u6570\u5e76\u7528\u8fed\u4ee3\u5668\u904d\u5386\u96c6\u5408\u5143\u7d20\u5e76\u8f93\u51fa"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >mport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.Random;\n\n\/\/\u5206\u6790\u4ee5\u4e0b\u9700\u6c42\uff0c\u5e76\u7528\u4ee3\u7801\u5b9e\u73b0\n\/\/(1)\u751f\u621010\u4e2a1\u81f3100\u4e4b\u95f4\u7684\u968f\u673a\u6574\u6570(\u4e0d\u80fd\u91cd\u590d)\uff0c\u5b58\u5165\u4e00\u4e2aList\u96c6\u5408\n\/\/(2)\u7136\u540e\u5229\u7528\u8fed\u4ee3\u5668\u548c\u589e\u5f3afor\u5faa\u73af\u5206\u522b\u904d\u5386\u96c6\u5408\u5143\u7d20\u5e76\u8f93\u51fa\n\/\/(3)\u5982\uff1a15 18 20 40 46 60 65 70 75 91\npublic class Test004 {\n\tpublic static void main(String&#091;] args) {\n\t\t\/\/ (1)\u751f\u621010\u4e2a1\u81f3100\u4e4b\u95f4\u7684\u968f\u673a\u6574\u6570(\u4e0d\u80fd\u91cd\u590d)\uff0c\u5b58\u5165\u4e00\u4e2aList\u96c6\u5408\n\n\t\tList l = new ArrayList();\n\t\tRandom r = new Random();\n\n\t\tfor (int i = 0; i &lt; 10; i++) {\n\t\t\tint sj = r.nextInt(100) + 1;\n\t\t\tif (l.contains(sj)) {\n\t\t\t\ti--;\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\tl.add(sj);\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(l);\n\t\tSystem.out.println(&quot;----------&quot;);\n\t\t\/\/=========================\n\t\t\/\/(2)\u7136\u540e\u5229\u7528\u8fed\u4ee3\u5668\u548c\u589e\u5f3afor\u5faa\u73af\u5206\u522b\u904d\u5386\u96c6\u5408\u5143\u7d20\u5e76\u8f93\u51fa\n\t\tIterator it = l.iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tObject aa =  it.next();\n\t\t\tSystem.out.print(aa+&quot; &quot;);\n\t\t}\n\t\tSystem.out.println(&quot; &quot;);\n\t\tSystem.out.println(&quot;\u2191\u8fed\u4ee3\u5668           \u589e\u5f3afor\u2193&quot;);\n\t\tfor (Object object : l) {\n\t\t\tSystem.out.print(object+&quot; &quot;);\n\t\t}\n\t}\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":196,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"class_list":["post-134","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xuexi"],"_links":{"self":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=134"}],"version-history":[{"count":0,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/media\/196"}],"wp:attachment":[{"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}