选择数字
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
给定一行 个非负整数 。现在你可以选择其中若干个数,但不能有超过 个连续的数字被选择。你的任务是使得选出的数字的和最大。
输入格式
第一行两个整数 ,。
以下 行,每行一个整数表示 。
输出格式
输出一个值表示答案。
5 2
1
2
3
4
5
12
提示
对于 的数据,。
对于另外 的数据,。
对于 的数据,。
对于 的数据,,, 数字大小 。
时间限制 ms。
单调队列优化的动态规划
- Status
- Done
- Problem
- 21
- Open Since
- 2025-7-10 0:00
- Deadline
- 2025-8-7 23:59
- Extension
- 24 hour(s)