ref

#include <iostream>
#include <cstdio>
using namespace std;
int a[100005], n, l, ans=0x3f3f3f3f;
int main(){
cin>>n>>l;
for(int i=1; i<n; i++){
scanf("%d", &a[i]);
a[i] += a[i-1];
}
for(int i=l; i<n; i++)
ans = min(ans, a[i]-a[i-l]);
cout<<ans<<endl;
return 0;
}

cf965d Single-use Stones的更多相关文章

  1. 「口胡题解」「CF965D」Single-use Stones

    目录 题目 口胡题解 题目 有许多的青蛙要过河,可惜的是,青蛙根本跳不过河,他们最远只能跳 \(L\) 单位长度,而河宽 \(W\) 单位长度. 在河面上有一些石头,距离 \(i\) 远的地方有 \( ...

  2. EM_LGH CF965D Single-use Stones 思维_推理

    Code: #include<cstdio> #include<algorithm> using namespace std; const int maxn = 1000000 ...

  3. codechef Jewels and Stones 题解

    Soma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery acces ...

  4. HOJ 2156 &POJ 2978 Colored stones(线性动规)

    Colored stones Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1759 Accepted: 829 Descrip ...

  5. Codeforces 768 E. Game of Stones 博弈DP

    E. Game of Stones   Sam has been teaching Jon the Game of Stones to sharpen his mind and help him de ...

  6. Yin and Yang Stones(思路题)

    Problem Description: A mysterious circular arrangement of black stones and white stones has appeared ...

  7. C - Stones on the Table

    Problem description There are n stones on the table in a row, each of them can be red, green or blue ...

  8. linux-关机出现Telling INIT to go to single user mode.无法关机

    运行/sbin/shutdown now最后显示:Telling INIT to go to single user mode.INIT:Going single userINIT:Sending g ...

  9. [LeetCode] Single Number III 单独的数字之三

    Given an array of numbers nums, in which exactly two elements appear only once and all the other ele ...

随机推荐

  1. windows10下git报错warning: LF will be replaced by CRLF in readme.txt. The file will have its original line endings in your working directory.

    window10下使用git时 报错如下: $ git add readme.txtwarning: LF will be replaced by CRLF in readme.txt.The fil ...

  2. LeetCode 4Sum 4个数之和

    题意:这是继2sum和3sum之后的4sum,同理,也是找到所有4个元素序列,满足他们之和为target.以vector<vector<int>>来返回,也就是二维的,列长为4 ...

  3. hiho一下 第三十八周 二分答案

    题目链接:http://hihocoder.com/contest/hiho38/problem/1 ,挺难想的解题思路,好题. 按照提示的算法来: 我们需要找什么? 在这个题目中我们需要找的是路径最 ...

  4. CAsyncSocket create创建套接字失败

    解决方法: 在继承CAsyncSocket 类的子类的构造函数中加入以下代码: if (!AfxSocketInit()) AfxMessageBox(IDP_SOCKETS_INIT_FAILED) ...

  5. webpack最简单的入门教程里bundle.js之运行单步调试的原理解析

    读这篇文章的朋友,请确保对webpack有最基础的认识. 您可以阅读我前一篇文章:Webpack 10分钟入门 来在本地运行一个Webpack的hello world项目.https://www.to ...

  6. httpd2.4.6三种工作模式(如何配置),防止占用内存暴增的策略

    之前偷懒默认用yum安装了httpd.后来发现服务器内存暴增,一度达到75% 打开一看,好嘛后台休眠进程全是httpd. 重启之后再度访问发现内存还是稳步增长. [root@iz2ze3ayxs2yp ...

  7. 动态规划专题(四)——单调队列优化DP

    前言 单调队列优化\(DP\)应该还算是比较简单容易理解的吧,像它的升级版斜率优化\(DP\)就显得复杂了许多. 基本式子 单调队列优化\(DP\)的一般式子其实也非常简单: \[f_i=max_{j ...

  8. python_29_三级菜单

    menu={ '北京':{ '海淀':{ '五道口':{ '搜狐':{}, '网易':{}, 'Google':{}, }, '中关村':{ '爱奇艺':{}, '汽车之家':{}, '优酷':{}, ...

  9. 记Tea使用中遇到的问题及解决过程

    学习Markdown时,在小众软件看到一个叫Tea的软件.UI设计是简约风格:"所见即所得"的Markdown:支持插件等原因让我选择去尝试这杯"茶". 最近一 ...

  10. 简述apache,php,mysql三者的关系

    转自:http://blog.csdn.net/w1365966490/article/details/8218959 Apache web 服务器软件.同类产品有微软的 IIS 等.功能是让某台电脑 ...