Skip to content

Commit

Permalink
e200: Add sms promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
XuShaohua committed Sep 18, 2024
1 parent 1d31dde commit eeed4ea
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
- [导师请吃火锅 - DFS](od/2024e200/hot-pot/index.md)
- [最大相连男生数/学生方阵](od/2024e200/adjacent-schoolboys/index.md)
- [数字游戏](od/2024e200/digit-game/index.md)
- [云短信平台优惠活动 - DP](od/2024e200/sms-promotions/index.md)
- [寻找符合要求的最长子串 - 滑动窗口](od/2024e200/longest-substring/index.md)
- [跳格子3 - 动态规划](od/2024e200/hopscotch3/index.md)
- [二叉树计算 - 树](od/2024e200/calculate-binary-tree/index.md)
Expand Down
13 changes: 7 additions & 6 deletions src/od/2024e200/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
12. [导师请吃火锅 - DFS](hot-pot/index.md)
13. [最大相连男生数/学生方阵](adjacent-schoolboys/index.md)
14. [数字游戏](digit-game/index.md)
15. [寻找符合要求的最长子串 - 滑动窗口](longest-substring/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)
15. [云短信平台优惠活动 - DP](sms-promotions/index.md)
16. [寻找符合要求的最长子串 - 滑动窗口](longest-substring/index.md)
17. [跳格子3 - 动态规划](hopscotch3/index.md)
18. [二叉树计算 - 树](calculate-binary-tree/index.md)
19. [猴子吃桃/爱吃蟠桃的孙悟空 - 二分查找](monkey-eats-peach/index.md)
20. [机器人活动区域 - DFS](moving-area-of-robot/index.md)
21. [简易压缩算法/一种字符串压缩表示的解压 - 字符串](compress-string/index.md)
7 changes: 7 additions & 0 deletions src/od/2024e200/sms-promotions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "e200-sms-promotions"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
2 changes: 2 additions & 0 deletions src/od/2024e200/sms-promotions/assets/input1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
6
10 20 30 40 60
2 changes: 2 additions & 0 deletions src/od/2024e200/sms-promotions/assets/input2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
15
10 20 30 40 60 60 70 80 90 150
1 change: 1 addition & 0 deletions src/od/2024e200/sms-promotions/assets/output1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
70
1 change: 1 addition & 0 deletions src/od/2024e200/sms-promotions/assets/output2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
210
50 changes: 50 additions & 0 deletions src/od/2024e200/sms-promotions/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 云短信平台优惠活动

## 题目描述

某云短信厂商, 为庆祝国庆, 推出充值优惠活动.
现在给出客户预算, 和优惠售价序列, 求最多可获得的短信总条数.

### 输入描述

- 第一行客户预算M, 其中 0 ≤ M ≤ 10^6
- 第二行给出售价表, P1, P2, … Pn, 其中 1 ≤ n ≤ 100
- Pi为充值 i 元获得的短信条数. 1 ≤ Pi ≤ 1000 , 1 ≤ n ≤ 100

### 输出描述

最多获得的短信条数.

### 示例1

输入:

```text
{{#include assets/input1.txt}}
```

输出:

```text
{{#include assets/output1.txt}}
```

说明: 分两次充值最优, 1元, 5元各充一次, 总条数 10 + 60 = 70.

### 示例2

输入:

```text
{{#include assets/input2.txt}}
```

输出:

```text
{{#include assets/output2.txt}}
```

说明: 分两次充值最优, 10元, 5元各充一次, 总条数 150 + 60 = 210.

## 题解
3 changes: 3 additions & 0 deletions src/od/2024e200/sms-promotions/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

0 comments on commit eeed4ea

Please sign in to comment.