From ebde2a7cb081817a0e0f5d5029938c7a7ea3b53c Mon Sep 17 00:00:00 2001 From: jlhde123 <472327024@qq.com> Date: Tue, 14 Mar 2017 16:39:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1=E3=80=81=E5=BD=92=E5=B9=B6=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jlh/viewer/algorithm/MergeSort.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 jlh/src/main/java/com/jlh/viewer/algorithm/MergeSort.java diff --git a/jlh/src/main/java/com/jlh/viewer/algorithm/MergeSort.java b/jlh/src/main/java/com/jlh/viewer/algorithm/MergeSort.java new file mode 100644 index 0000000..89d6177 --- /dev/null +++ b/jlh/src/main/java/com/jlh/viewer/algorithm/MergeSort.java @@ -0,0 +1,67 @@ +package com.jlh.viewer.algorithm; + +import java.util.Arrays; + +/** + * Created by jlh + * On 2017/3/14 0014. + */ +public class MergeSort { + public static void main(String[] args) { + int b[]={4,5,1,2,3,8,11,6,7,10}; + MergeSort mergeSort= new MergeSort(); + mergeSort.sort(b,0,b.length); + Arrays.stream(b).forEach(System.out::println); + } + + public void sort (int a[],int first,int last){ + reslove(a,first,last-1,new int[a.length]); + } + + public void reslove(int a[],int first,int last,int []temp){ + if (first Date: Tue, 14 Mar 2017 20:46:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?HDU1004=E3=80=81HDU1005?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/jlh/viewer/acm/HDU1004.java | 57 +++++++++++++++++++ .../main/java/com/jlh/viewer/acm/HDU1005.java | 29 ++++++++++ 2 files changed, 86 insertions(+) create mode 100644 jlh/src/main/java/com/jlh/viewer/acm/HDU1004.java create mode 100644 jlh/src/main/java/com/jlh/viewer/acm/HDU1005.java diff --git a/jlh/src/main/java/com/jlh/viewer/acm/HDU1004.java b/jlh/src/main/java/com/jlh/viewer/acm/HDU1004.java new file mode 100644 index 0000000..e9fe605 --- /dev/null +++ b/jlh/src/main/java/com/jlh/viewer/acm/HDU1004.java @@ -0,0 +1,57 @@ +package com.jlh.viewer.acm; + +import java.util.Scanner; + +/** + * com.jlh.viewer.acm + * Created by ASUS on 2017/3/14. + * 19:43 + */ +public class HDU1004 { + private static String index[]=new String[1005]; + private static int length; + private static int count[]=new int[1005]; + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + while (true){ + int n= sc.nextInt(); + if (n==0) + break; + sc.nextLine(); + init(n); + for (int i=0;i