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. javascript之 JavaScript 工具库

    javascript之 JavaScript 工具库jQuery 目录: 一.查找标签和事件绑定以及操作标签的对比 二.DOM对象和jquery的转换 三.$(document).ready( )  ...

  2. C#之razor

    学习的文章在这里:http://www.cnblogs.com/yang_sy/archive/2013/08/26/ASPNET_MVC_RAZOR_ENGINE.html 1.视图开始文件_Vie ...

  3. jquery实现加载更多效果

    情况是当滑动条滑动到最底部的时候,数据显示出一部分的更多 思路:获取到浏览器屏幕的高度client,文档的高度h和滑动距离顶部的距离scroll,当h<=client+scroll的时候就是滑动 ...

  4. iOS Dispatch_sync 阻塞线程的原因

    大家的知道在主队列上使用dispatch_sync(), - (void)testSyncMainThread { dispatch_queue_t main = dispatch_get_main_ ...

  5. Problem G: 圆周率

    Problem G: 圆周率 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 155  Solved: 99[Submit][Status][Web Bo ...

  6. 【luogu P3609 [USACO17JAN]Hoof, Paper, Scissor蹄子剪刀布】 题解

    题目链接:https://www.luogu.org/problemnew/show/P3609 ### 看着标签什么记搜什么暴力点进来,读完题第一直觉DP? 还真是个\(DP\). 题目所描述的状态 ...

  7. 题解 P1280 【尼克的任务】

    传送门 f[i]表示i~n的最长空闲时间: 如果当前无任务就休息一秒(f[i]=f[i+1]+1): 否则f[i]=max(f[i],f[i+当前工作时间]); 用结构体来记录,我们对于每一个时刻开一 ...

  8. java调用摄像头了

    http://www.cnblogs.com/cnweiblog/p/4602207.html

  9. Struts动态联动效果

    <%@page contentType="text/html;charset=utf-8"%> <%@ include file="../../comm ...

  10. 前端小记6——项目中常用的ES6方法

    现在很多功能用es5的方法也能实现功能,但es6提供的方法显得更为高效.记录下目前常用的几个方法. 1.字符包含 通过str.includes('a')来判断, 若str中包含a则结果为true,否则 ...