diff --git a/GE_Migrating_data/lib/HistorianServiceAPI.jar b/GE_Migrating_data/lib/HistorianServiceAPI.jar new file mode 100644 index 0000000..f7d0785 Binary files /dev/null and b/GE_Migrating_data/lib/HistorianServiceAPI.jar differ diff --git a/GE_migate/pom.xml b/GE_migate/pom.xml new file mode 100644 index 0000000..38209fc --- /dev/null +++ b/GE_migate/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + com.cqu.ge + GE_migate + 1.0-SNAPSHOT + + + junit + junit + RELEASE + compile + + + + com.cqu + ge + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + 8 + + + \ No newline at end of file diff --git a/GE_migate/src/main/java/OracleODBC.java b/GE_migate/src/main/java/OracleODBC.java new file mode 100644 index 0000000..07ae907 --- /dev/null +++ b/GE_migate/src/main/java/OracleODBC.java @@ -0,0 +1,157 @@ + +import java.io.FileInputStream; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +public class OracleODBC { + private static Connection conn; + private static PreparedStatement ps; + private static ResultSet rs; + private static String odbc_driver; + private static String odbc_url; + private static String username; + private static String password; + + public static void main(String[] args) { + // 测试 + String sql = "select * from emp"; + System.out.println("ODBC************"); + ResultSet rst = OracleODBC.executeQuery(sql, null); + try { + while(rst.next()){ + System.out.println(rst.getString("ename")); + } + } catch (Exception e) { + e.printStackTrace(); + }finally{ + OracleODBC.close(OracleODBC.getConn(),OracleODBC.getPs(),rst); + } + } + + + static{ + try { + Map map = get(); + odbc_driver = map.get("odbc_driver"); + odbc_url = map.get("odbc_url"); + username = map.get("username"); + password = map.get("password"); + + Class.forName(odbc_driver); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + + //初始化变量 + public static Map get(){ + Properties pp = new Properties(); + FileInputStream fis = null; + Map map = new HashMap(); + try { + fis = new FileInputStream("dbinfor.properties");//dbinfor.properties在工程路径下面 + pp.load(fis); + odbc_driver = pp.getProperty("odbc_driver"); + odbc_url = pp.getProperty("odbc_url"); + username = pp.getProperty("username"); + password = pp.getProperty("password"); + map.put("odbc_driver", odbc_driver); + map.put("odbc_url", odbc_url); + map.put("username", username); + map.put("password", password); + + } catch (Exception e) { + e.printStackTrace(); + } + return map; + } + + //增删改方法 + public static void executeUpdate(String sql,String []parameters){ + try { + conn = DriverManager.getConnection(odbc_url, username, password); + ps = conn.prepareStatement(sql); + if(parameters!=null){ + for(int i=0;i= 2) { + dp[i] = Math.max(dp[i], dp[i - 2] + nums[i - 1]); + } + if (i >= 3) { + dp[i] = Math.max(dp[i], dp[i - 3] + nums[i - 1]); + } + if (i >= 4 && i != 5) { + dp[i] = Math.max(dp[i], dp[i - 4] + nums[i - 1]); + } + } + + System.out.println(dp[n]); + } + + public void sovle1(int[] nums) { + int n = nums.length; + int[] dp = new int[n];//[不选,选] + dp[0]=nums[0]; + + for (int i = 1; i < n; i++) { + if (i >= 3) { + dp[i] = Math.max(dp[i - 3] + nums[i],dp[i - 1]); + } else { + dp[i]=Math.max(dp[i-1],nums[i]); + } + } + + System.out.println(dp[n-1]); + } + + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int[] a = new int[n]; + for (int i = 0; i < n; i++) { + a[i] = sc.nextInt(); + } + sc.close(); + + int[] dp = new int[n + 1]; + + for (int i = 1; i <= n; i++) { + dp[i] = dp[i - 1]; + if (i >= 2) { + dp[i] = Math.max(dp[i], dp[i - 2] + a[i - 1]); + } + if (i >= 3) { + dp[i] = Math.max(dp[i], dp[i - 3] + a[i - 1]); + } + if (i >= 4 && i != 5) { + dp[i] = Math.max(dp[i], dp[i - 4] + a[i - 1]); + } + } + + System.out.println(dp[n]); + } + +} diff --git a/Leecode/src/main/java/com/markilue/leecode/interview/meituan/Question3.java b/Leecode/src/main/java/com/markilue/leecode/interview/meituan/Question3.java new file mode 100644 index 0000000..5f61de1 --- /dev/null +++ b/Leecode/src/main/java/com/markilue/leecode/interview/meituan/Question3.java @@ -0,0 +1,66 @@ +package com.markilue.leecode.interview.meituan; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.Scanner; + +/** + * @BelongsProject: Leecode + * @BelongsPackage: com.markilue.leecode.interview.meituan + * @Author: marklue + * @CreateTime: 2023/3/25 19:18 + * @Description: TODO + * @Version: 1.0 + */ +public class Question3 { + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int m = sc.nextInt(); + int n = sc.nextInt(); + int[] weight = new int[m]; + int[] bag = new int[n]; + int max = 0; + for (int i = 0; i < weight.length; i++) { + weight[i] = sc.nextInt(); + } + + for (int i = 0; i < n; i++) { + bag[i] = sc.nextInt(); + max = Math.max(max, bag[i]); + } + int[] dp = new Question3().sovle(weight, max); + for (int i : bag) { + System.out.print(dp[i] + " "); + } + } + + @Test + public void test() { + int[] nums = {5,2,1,4,2}; + sovle(nums, 15); + } + + public int[] sovle(int[] weight, int bag) { + int[][] dp = new int[weight.length][bag + 1]; + + for (int i = 0; i < dp[0].length; i++) { + if (i >= weight[0] * weight[0]) dp[0][i] = 1; + } + for (int i = 1; i < dp.length; i++) { + for (int j = 1; j < dp[0].length; j++) { + int weight1 = weight[i] * weight[i]; + if (weight1 > j) dp[i][j]=dp[i-1][j]; + else dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - weight1] + 1); + } + } +// for (int i = 0; i < dp.length; i++) { +// System.out.println(Arrays.toString(dp[i])); +// } + return dp[dp.length-1]; + } + + + +} diff --git a/Leecode/src/main/java/com/markilue/leecode/interview/meituan/Question4.java b/Leecode/src/main/java/com/markilue/leecode/interview/meituan/Question4.java new file mode 100644 index 0000000..386ca96 --- /dev/null +++ b/Leecode/src/main/java/com/markilue/leecode/interview/meituan/Question4.java @@ -0,0 +1,49 @@ +package com.markilue.leecode.interview.meituan; + +import java.util.Scanner; + +/** + * @BelongsProject: Leecode + * @BelongsPackage: com.markilue.leecode.interview.meituan + * @Author: marklue + * @CreateTime: 2023/3/25 20:24 + * @Description: TODO + * @Version: 1.0 + */ +public class Question4 { + + + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int k = sc.nextInt(); + int[] a = new int[n + 1]; + for (int i = 1; i <= n; i++) { + a[i] = sc.nextInt(); + } + int[][][] dp = new int[n + 1][k + 1][2]; + // 初始化 + for (int j = 0; j <= k; j++) { + dp[1][j][0] = 0; + dp[1][j][1] = a[1]; + } + // 状态转移 + for (int i = 2; i <= n; i++) { + for (int j = 0; j <= k; j++) { + dp[i][j][0] = Math.max(dp[i - 1][j][0], dp[i - 1][j][1]); + if (j > 0) { + dp[i][j][1] = Math.max(dp[i - 1][j - 1][1] + a[i], dp[i - 1][j][0] + a[i]); + } else { + dp[i][j][1] = dp[i - 1][j][0] + a[i]; + } + } + } + // 取最大值 + int ans = 0; + for (int j = 0; j <= k; j++) { + ans = Math.max(ans, Math.max(dp[n][j][0], dp[n][j][1])); + } + System.out.println(ans); + } +} diff --git a/Leecode/src/main/java/com/markilue/leecode/listnode/selftry/DeleteDuplicates.java b/Leecode/src/main/java/com/markilue/leecode/listnode/selftry/DeleteDuplicates.java new file mode 100644 index 0000000..06f4af9 --- /dev/null +++ b/Leecode/src/main/java/com/markilue/leecode/listnode/selftry/DeleteDuplicates.java @@ -0,0 +1,54 @@ +package com.markilue.leecode.listnode.selftry; + +import com.markilue.leecode.listnode.ListNode; +import com.markilue.leecode.listnode.ListNodeUtils; +import org.junit.Test; + +public class DeleteDuplicates { + + @Test + public void test() { + ListNode root = ListNodeUtils.build(new int[]{1, 1, 2, 2}); + ListNodeUtils.print(deleteDuplicates(root)); + } + + + public ListNode deleteDuplicates(ListNode head) { + + ListNode fake = new ListNode(); + fake.next = head; + ListNode temp = head; + while (temp != null) { + if (temp.next != null && temp.val == temp.next.val) { + ListNode temp1 = temp.next; + while (temp1.next != null && temp1.val == temp1.next.val) { + temp1 = temp1.next; + } + temp.next = temp1.next; + } + temp = temp.next; + } + + return fake.next; + + } + + public ListNode deleteDuplicates1(ListNode head) { + if (head == null) { + return head; + } + + ListNode cur = head; + while (cur.next != null) { + if (cur.val == cur.next.val) { + cur.next = cur.next.next; + } else { + cur = cur.next; + } + } + + return head; + } + + +} diff --git a/Leecode/src/main/java/com/markilue/leecode/listnode/selftry/DeleteDuplicatesII.java b/Leecode/src/main/java/com/markilue/leecode/listnode/selftry/DeleteDuplicatesII.java new file mode 100644 index 0000000..9dbbd69 --- /dev/null +++ b/Leecode/src/main/java/com/markilue/leecode/listnode/selftry/DeleteDuplicatesII.java @@ -0,0 +1,52 @@ +package com.markilue.leecode.listnode.selftry; + + +import com.markilue.leecode.listnode.ListNode; +import com.markilue.leecode.listnode.ListNodeUtils; +import org.junit.Test; + +/** + * @BelongsProject: Leecode + * @BelongsPackage: com.markilue.leecode.listnode.selftry + * @Author: marklue + * @CreateTime: 2023/3/25 18:50 + * @Description: TODO 美团笔试 链表去重升级:把重复的也去掉 + * @Version: 1.0 + */ +public class DeleteDuplicatesII { + + @Test + public void test(){ + ListNode root = ListNodeUtils.build(new int[]{1, 1, 2,2,2}); + ListNodeUtils.print(deleteDuplicates(root)); + + } + + + public ListNode deleteDuplicates(ListNode head) { + + if (head == null) { + return head; + } + + ListNode fake = new ListNode(); + fake.next = head; + ListNode temp = fake; + while (temp.next != null) { + if (temp.next.next != null && temp.next.val == temp.next.next.val) { + ListNode temp1 = temp.next; + while (temp1.next != null && temp1.val == temp1.next.val) { + temp1 = temp1.next; + } + temp.next = temp1.next; + }else { + temp = temp.next; + } + + + } + + return fake.next; + + } +} diff --git a/TensorFlow_eaxmple/Model_train_test/703Test/703Connect.py b/TensorFlow_eaxmple/Model_train_test/703Test/703Connect.py new file mode 100644 index 0000000..fd51554 --- /dev/null +++ b/TensorFlow_eaxmple/Model_train_test/703Test/703Connect.py @@ -0,0 +1,25 @@ +import pyodbc + +# 定义连接字符串 +conn_str = ( + r"DRIVER=IhOLEDB.iHistorian.1;" + r"Persist Security Info=True;" + r"Mode=Read;" + r"server=192.168.9.8;" + r"uid=administrator;" + r"pwd=TES@ihistorian2018;" +) + +# 使用pyodbc连接数据库 +cnxn = pyodbc.connect(conn_str) + +# 执行SQL查询 +cursor = cnxn.cursor() +cursor.execute("select * from ihTags where tagname= [HN.DF.DF11.DF11_TC1].AIO.AN_Air_Supply_Pressure") + +# 处理结果集 +for row in cursor.fetchall(): + print(row) + +# 关闭连接 +cnxn.close() diff --git a/java_web/Tecent/pom.xml b/java_web/Tecent/pom.xml new file mode 100644 index 0000000..04e13d4 --- /dev/null +++ b/java_web/Tecent/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + com.makrilue.interview + Tecent + 1.0-SNAPSHOT + + + + junit + junit + 4.13.2 + test + + + junit + junit + 4.13.2 + compile + + + + + 8 + 8 + + + \ No newline at end of file diff --git a/java_web/Tecent/src/main/java/com/markilue/interview/Question3.java b/java_web/Tecent/src/main/java/com/markilue/interview/Question3.java new file mode 100644 index 0000000..370376f --- /dev/null +++ b/java_web/Tecent/src/main/java/com/markilue/interview/Question3.java @@ -0,0 +1,57 @@ +package com.markilue.interview; + +import org.junit.Test; +import org.junit.runner.notification.RunListener; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +public class Question3 { + + @Test + public void test() { + String s = "nowcoder"; + String[] dic = {"now", "coder", "no", "wcoder"}; + System.out.println(Arrays.toString(wordDiv(s, dic))); + } + + /** + * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 + * + * @param s string字符串 + * @param dic string字符串一维数组 + * @return string字符串一维数组 + */ + public String[] wordDiv(String s, String[] dic) { + // write code here + List result = new ArrayList<>(); + if (s == null || s.length() == 0 || dic.length == 0) { + return result.toArray(new String[0]); + } + List wordDic = Arrays.asList(dic); + HashSet set = new HashSet<>(wordDic); + StringBuilder sb = new StringBuilder(); + backtracking(s, set, 0, sb, result); + return result.toArray(new String[0]); + } + + private void backtracking(String s, HashSet set, int start, StringBuilder sb, List result) { + if (start == s.length()) { + result.add(sb.toString().trim()); + return; + } + + for (int i = start; i < s.length(); i++) { + String word = s.substring(start, i + 1); + if (set.contains(word)) { + sb.append(word).append(" "); + backtracking(s, set, i + 1, sb, result); + sb.delete(sb.length() - word.length() - 1, sb.length()); + } + } + } + + +} diff --git a/java_web/Tecent/src/main/java/com/markilue/interview/Question4.java b/java_web/Tecent/src/main/java/com/markilue/interview/Question4.java new file mode 100644 index 0000000..5df695f --- /dev/null +++ b/java_web/Tecent/src/main/java/com/markilue/interview/Question4.java @@ -0,0 +1,6 @@ +package com.markilue.interview; + +public class Question4 { + + +}