酷代码 AI
菜单
服务商

求解连续 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]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]