diff --git a/leetcode b/leetcode deleted file mode 120000 index 3eb14711d..000000000 --- a/leetcode +++ /dev/null @@ -1 +0,0 @@ -src/leetcode/ \ No newline at end of file diff --git a/src/README.md b/src/README.md index 230a919ab..cff767904 100644 --- a/src/README.md +++ b/src/README.md @@ -10,6 +10,7 @@ 2. 第二部分: 算法 3. 第三部分: 专题 4. 第四部分: leetcode 题解 +5. 华为 OD 机试题解 ## 反馈问题 diff --git a/src/SUMMARY.md b/src/SUMMARY.md index cd0580a82..e3e09249c 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -399,6 +399,7 @@ - [最大相连男生数/学生方阵](od/2024e200/adjacent-schoolboys/index.md) - [数字游戏](od/2024e200/digit-game/index.md) - [寻找符合要求的最长子串 - 滑动窗口](od/2024e200/longest-substring/index.md) + - [跳格子3 - 动态规划](od/2024e200/hopscotch3/index.md) - [二叉树计算 - 树](od/2024e200/calculate-binary-tree/index.md) - [猴子吃桃/爱吃蟠桃的孙悟空 - 二分查找](od/2024e200/monkey-eats-peach/index.md) - [机器人活动区域 - DFS](od/2024e200/moving-area-of-robot/index.md) diff --git a/src/od/.gitignore b/src/od/.gitignore deleted file mode 100644 index bc0fadee5..000000000 --- a/src/od/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/book -/target -target diff --git a/src/od/2024e200/hopscotch3/Cargo.toml b/src/od/2024e200/hopscotch3/Cargo.toml new file mode 100644 index 000000000..59a26c6fb --- /dev/null +++ b/src/od/2024e200/hopscotch3/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "e200-hopscotch3" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] diff --git a/src/od/2024e200/hopscotch3/assets/input1.txt b/src/od/2024e200/hopscotch3/assets/input1.txt new file mode 100644 index 000000000..d1b217c4b --- /dev/null +++ b/src/od/2024e200/hopscotch3/assets/input1.txt @@ -0,0 +1,3 @@ +6 +1 -1 -6 7 -17 7 +2 \ No newline at end of file diff --git a/src/od/2024e200/hopscotch3/assets/output1.txt b/src/od/2024e200/hopscotch3/assets/output1.txt new file mode 100644 index 000000000..da2d3988d --- /dev/null +++ b/src/od/2024e200/hopscotch3/assets/output1.txt @@ -0,0 +1 @@ +14 \ No newline at end of file diff --git a/src/od/2024e200/hopscotch3/index.md b/src/od/2024e200/hopscotch3/index.md new file mode 100644 index 000000000..256b43c93 --- /dev/null +++ b/src/od/2024e200/hopscotch3/index.md @@ -0,0 +1,38 @@ +# 跳格子3 + +## 题目描述 + +小明和朋友们一起玩跳格子游戏, 每个格子上有特定的分数 score = [1, -1, -6, 7, -17, 7], + +从起点score[0]开始, 每次最大的步长为k, 请你返回小明跳到终点 score[n-1] 时, 能得到的最大得分. + +### 输入描述 + +- 第一行输入总的格子数量 n +- 第二行输入每个格子的分数 score[i] +- 第三行输入最大跳的步长 k + +备注: + +- 格子的总长度 n 和步长 k 的区间在 [1, 100000] +- 每个格子的分数 score[i] 在 [-10000, 10000] 区间中 + +### 输出描述 + +输出最大得分. + +### 示例1 + +输入: + +```text +{{#include assets/input1.txt}} +``` + +输出: + +```text +{{#include assets/output1.txt}} +``` + +## 题解 diff --git a/src/od/2024e200/hopscotch3/src/main.rs b/src/od/2024e200/hopscotch3/src/main.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/src/od/2024e200/hopscotch3/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/src/od/2024e200/index.md b/src/od/2024e200/index.md index e202870ef..9d58107a2 100644 --- a/src/od/2024e200/index.md +++ b/src/od/2024e200/index.md @@ -15,7 +15,8 @@ 13. [最大相连男生数/学生方阵](adjacent-schoolboys/index.md) 14. [数字游戏](digit-game/index.md) 15. [寻找符合要求的最长子串 - 滑动窗口](longest-substring/index.md) -16. [二叉树计算 - 树](calculate-binary-tree/index.md) -17. [猴子吃桃/爱吃蟠桃的孙悟空 - 二分查找](monkey-eats-peach/index.md) -18. [机器人活动区域 - DFS](moving-area-of-robot/index.md) -19. [简易压缩算法/一种字符串压缩表示的解压 - 字符串](compress-string/index.md) +16. [跳格子3 - 动态规划](hopscotch3/index.md) +17. [二叉树计算 - 树](calculate-binary-tree/index.md) +18. [猴子吃桃/爱吃蟠桃的孙悟空 - 二分查找](monkey-eats-peach/index.md) +19. [机器人活动区域 - DFS](moving-area-of-robot/index.md) +20. [简易压缩算法/一种字符串压缩表示的解压 - 字符串](compress-string/index.md)