From c563b2f33c11c21fdcc0375c81907962940afa18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=87=91=E6=B2=B3?= <1262113654@qq.com> Date: Thu, 6 Aug 2020 09:49:54 +0800 Subject: [PATCH 1/3] hello.txt --- hello.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 hello.txt diff --git a/hello.txt b/hello.txt new file mode 100644 index 0000000..e69de29 From 16b92b06580113bbedb59d40ebb444e6ff4ac557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=87=91=E6=B2=B3?= <1262113654@qq.com> Date: Fri, 7 Aug 2020 00:18:19 +0800 Subject: [PATCH 2/3] jjcc.java --- jjcc.java | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 jjcc.java diff --git a/jjcc.java b/jjcc.java new file mode 100644 index 0000000..0f82148 --- /dev/null +++ b/jjcc.java @@ -0,0 +1,35 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author dell + */ +public class jjcc { + public static void main(String[] args) + { + System.out.println(add(1,2)); + System.out.println(sub(1,2)); + System.out.println(mul(1,2)); + System.out.println(div(1,2)); + } + public static double add(double a,double b) + { + return a+b; + } + public static double sub(double a,double b) + { + return a-b; + } + public static double mul(double a,double b) + { + return a*b; + } + public static double div(double a,double b) + { + return (double)a/b; + } +} \ No newline at end of file From f2a3f3eff8d66ae965f19330cef80fd965c748f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=87=91=E6=B2=B3?= <1262113654@qq.com> Date: Fri, 7 Aug 2020 00:36:42 +0800 Subject: [PATCH 3/3] BianrySearch.java --- BianrySearch.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 BianrySearch.java diff --git a/BianrySearch.java b/BianrySearch.java new file mode 100644 index 0000000..bf6f3fa --- /dev/null +++ b/BianrySearch.java @@ -0,0 +1,47 @@ +import edu.princeton.cs.algs4.In; +import edu.princeton.cs.algs4.StdIn; +import edu.princeton.cs.algs4.StdOut; +import java.io.FileInputStream; +import java.util.Arrays; + +public class BianrySearch { + + + public static int rank(int k,int[] a){ + int lo=0; + int hi=a.length-1; + while(lo<=hi){ + int mid=(lo+hi)/2; + if(k>a[mid]){ + lo=mid+1; + } + else if(k