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. ubuntu下virtualbox的卸载

    本想在ubuntu下virtualbox,可惜出错了,需要卸载后再安装,只能百度拼凑后再安装: 1.首先是执行删除命令:sudo apt-get remove virtualbox*( 这样就不用去查 ...

  2. PHP报错configure error Cannot find libmysqlclient under usr

    编译PHP报错configure error Cannot find libmysqlclient under usr的解决方法 (问题产生,mysql是yum安装的,libmysqlclient* ...

  3. echo -e的用法

    root@bt:~# echo -e "HEAD /HTTP/1.0\n\n"HEAD /HTTP/1.0 root@bt:~# echo -e "HEAD /HTTP/ ...

  4. Get query parameter from url

    URL = { getUrlParams: function ( name, url ) { if (!url) url = window.location.href; name = name.rep ...

  5. javascript实现 滚动条滚动 加载内容

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. HDU3954 线段树(区间更新 + 点更新)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3954 , 一道比较好的线段树题,值得做. 题目是NotOnlySuccess大神出的,借此题来膜拜一下 ...

  7. Python开发第三篇

    函数 一.函数参数传值 形参:函数在定义的时候给定的参数 实参:函数在运行时赋给的参数: def func(i):#i为定义时的参数,为形参 pass func(name)#name为运行时的参数,为 ...

  8. python_70_内置函数2

    #hex() 转16进制 oct()转8进制 print(hex(255)) print(oct(10)) #id() 返回内存地址 print(id('a')) ''' isinstance(obj ...

  9. ARC机制中的Strong和weak

    什么是ARC Automatic Reference Counting,自动引用计数,即ARC,可以说是WWDC2011和iOS5所引入的最大的变革和最激动人心的变化.ARC是新的LLVM 3.0编译 ...

  10. Vim编辑器基础命令

    Linux系统中都默认安装了vi或vim编辑器,两种命令基本一致.vim为Vi IMproved,功能更强大. vim有命令模式,输入模式,和末行模式三种. ➢ 命令模式:控制光标移动,可对文本进行复 ...