求解连续 m 件烦人之事最小痛苦值总和问题及输入输出示例
题目描述 Recently, there have been $n$ annoying things, and each thing has a positive integer pain - inflicting value (since the person has extremely poor psychological endurance). God of Love and Sorrow wants to know what the minimum sum of the pain - inflicting values of $m$ consecutive things is. However, due to his busy schedule, God of Love and Sorrow has to ask you to write a program to tell him. 输入格式 The first line contains two integers separated by a space, representing $n$ and $m$ respectively. From the second line to the $(n + 1)$ - th line, there is an integer in each line. The integer $a_i$ in the $(i + 1)$ - th line represents the pain - inflicting value $a_i$ of the $i$ - th thing. 输出格式 Output a single integer on one line, representing the minimum sum of the pain - inflicting values of $m$ consecutive things. 输入输出样例 输入 #1 复制 ``` 8 3 1 4 7 3 1 2 4 3 ``` 输出 #1 复制 ``` 6 ``` 说明/提示 数据规模与约定 - For 30% of the data, it is guaranteed that $n\leq20$. - For 60% of the data, it is guaranteed that $n\leq100$. - For 90% of the data, it is guaranteed that $n\leq10^3$. - For 100% of the data, it is guaranteed that $0\leq m\leq n\leq3\times10^3$ and $1\leq a_i\leq100$. ######[AI问答 | 386点数解答 | 2025-11-24 19:53:30]
- Java实现链表反转:迭代与递归双解法详解及开发实战指南(DeepSeek | 1409点数解答 | 2026-03-15 15:09:29)30
- 深入解析洛谷打卡系统:规则揭秘与代码实现(字节豆包 | 316点数解答 | 2025-11-16 19:45:59)108
- 探寻数组中最长摆动子序列长度:思路剖析与代码优化(GPT | 758点数解答 | 2024-12-23 23:18:29)271
- 独家剖析:求解数组最长摆动子序列长度的代码实现与改进建议(GPT | 350点数解答 | 2024-12-23 23:20:54)269
- 旅行售货员问题:详细步骤剖析与贪心算法Python代码实现(字节豆包 | 444点数解答 | 2024-12-17 03:32:59)279
- Dev C++ 实现旅行售货员问题:最小路程路线代码与详细解析 (字节豆包 | 448点数解答 | 2024-12-17 03:33:42)182
- Python实现:读入正整数后从大到小打印,代码详解!(字节豆包 | 165点数解答 | 2025-12-07 09:44:50)76
- Python求解n以内3的倍数:代码实现及开发注意事项 (字节豆包 | 222点数解答 | 2025-12-07 12:28:15)46
- C语言实现:无输入打印精美心形图案代码揭秘(DeepSeek | 72点数解答 | 2025-12-15 17:38:15)38
- C++ 求解 P1020 小核桃与删除字符串问题:双指针与枚举策略 (字节豆包 | 330点数解答 | 2026-02-07 18:40:10)28
- 浙闽“板凳龙”舞龙队 300 秒螺线盘入:位置与速度全揭秘(阿里通义 | 886点数解答 | 2024-09-07 10:31:31)635
- 浙闽“板凳龙”舞龙队 300 秒位置与速度数学模型揭秘(GPT | 565点数解答 | 2024-09-07 10:32:56)533