{"id":350,"date":"2012-05-17T14:43:00","date_gmt":"2012-05-17T06:43:00","guid":{"rendered":"http:\/\/wangkaixuan.tech\/?p=350"},"modified":"2020-06-06T14:44:34","modified_gmt":"2020-06-06T06:44:34","slug":"%e5%bf%ab%e6%8e%92","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=350","title":{"rendered":"\u5feb\u6392"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\/\/Util.java\n \npackage wkx;\n \nimport java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.Date;\nimport java.util.Random;\nimport java.util.Scanner;\n \npublic class Util {\n\tpublic static void genneralRandomNum(int len) {\n\t\tRandom r = new Random(new Date().getTime());\n\t\twhile (len-- != 0)\n\t\t\tSystem.out.println(r.nextInt(1000));\n\t}\n \n\tprivate static int ans&#91;] = new int&#91;11];\n\tprivate static boolean visit&#91;] = new boolean&#91;11];\n \n\tprivate static void DFS(int dept,int n,PrintWriter out) throws IOException{\n\t\tfor(int i=1;i&lt;=n;i++){\n\t\t\tif(!visit&#91;i]){\n\t\t\t\tvisit&#91;i]=true;\n\t\t\t\tans&#91;dept]=i;\n\t\t\t\tif(dept&lt;n){\n\t\t\t\t\tDFS(dept+1,n,out);\n\t\t\t\t}else{\n\t\t\t\t\tfor(int j=1;j&lt;=n;j++)\n\t\t\t\t\t\tout.print(ans&#91;j]);\n\t\t\t\t\tout.println();\n\t\t\t\t\t\/*for(int j=1;j&lt;=n;j++)\n\t\t\t\t\t\tSystem.out.print(ans&#91;j]);\n\t\t\t\t\tSystem.out.println();*\/\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tvisit&#91;i]=false;\n\t\t\t}\n\t\t}\n\t}\n \n\tpublic static void genneralFullArray(int n) throws IOException {\n\t\tPrintWriter out=Util.getWriter();\n\t\tUtil.DFS(1, n,out);\n\t\tout.close();\n\t}\n \n\tpublic static Scanner getReader() throws FileNotFoundException {\n\t\treturn new Scanner(new FileInputStream(\n\t\t\t\t\"C:\\\\Users\\\\Jack\\\\Desktop\\\\input.txt\"));\n\t}\n \n\tpublic static BufferedReader getBufferReader() throws FileNotFoundException {\n\t\treturn new BufferedReader(new FileReader(\n\t\t\t\t\"C:\\\\Users\\\\Jack\\\\Desktop\\\\input.txt\"));\n\t}\n \n\tpublic static PrintWriter getWriter() throws IOException {\n\t\treturn new PrintWriter(new FileWriter(\n\t\t\t\t\"C:\\\\Users\\\\Jack\\\\Desktop\\\\output.txt\"));\n\t}\n \n\tpublic static void close(Scanner io) {\n\t\tif (io != null)\n\t\t\tio.close();\n\t}\n \n\tpublic static void close(BufferedReader io) throws IOException {\n\t\tif (io != null)\n\t\t\tio.close();\n\t}\n \n\tpublic static void close(PrintWriter io) {\n\t\tif (io != null)\n\t\t\tio.close();\n\t}\n \n}\n \n\/\/Sort.java\n \n \npackage wkx;\n \nimport java.util.List;\n \npublic class Sort {\n \n\tprivate static int partition(List&lt;Integer> list, int beg, int end) {\n\t\t\/\/ \u968f\u673a\u5316\n \n\t\tint temp = list.get(beg);\n\t\twhile (beg &lt; end) {\n\t\t\twhile (beg &lt; end &amp;&amp; list.get(end) >= temp)\n\t\t\t\tend--;\n\t\t\tlist.set(beg, list.get(end));\n\t\t\twhile (beg &lt; end &amp;&amp; list.get(beg) &lt;= temp)\n\t\t\t\tbeg++;\n\t\t\tlist.set(end, list.get(beg));\n\t\t}\n\t\tlist.set(beg, temp);\n\t\treturn beg;\n\t}\n \n\tpublic static void qSort(List&lt;Integer> list, int beg, int end) {\n\t\t\/\/ Collections.sort(list);\n\t\tif (beg >= end)\n\t\t\treturn;\n\t\tint mid = partition(list, beg, end);\n\t\tqSort(list, beg, mid - 1);\n\t\tqSort(list, mid + 1, end);\n\t}\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-350","post","type-post","status-publish","format-standard","hentry","category-06-03-play-ground"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/350\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}