codeforces 363B
#include<stdio.h>
#include<string.h>
#define inf 999999999
#define N 151000
int a[N],c[N];
int main() {
int n,k,i,j,min,p,t;
while(scanf("%d%d",&n,&k)!=EOF) {
min=inf;
memset(c,0,sizeof(c));
for(i=1;i<=n;i++) {
scanf("%d",&a[i]);
c[i]=a[i]+c[i-1];
if(i>=k) {
p=i-k+1;
t=c[i]-c[p-1];
if(min>t) {
min=t;
j=p;
}
}
}
printf("%d\n",j);
}
return 0;
}
codeforces 363B的更多相关文章
- CodeForces 363B Fence
Fence Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
- CodeForces - 696B Puzzles
http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
随机推荐
- WebSphere中数据源连接池太小导致的连接超时错误记录
WebSphere中数据源连接池太小导致的连接超时错误记录. 应用连接超时错误信息: [// ::: CST] webapp E com.ibm.ws.webcontainer.webapp.WebA ...
- 16-2 基于localStorage或sessionStorage的计数器
localStorage 方法 localStorage 方法存储的数据没有时间限制.第二天.第二周或下一年之后,数据依然可用. <!doctype html> <html> ...
- 转 php中$_request与$_post、$_get的区别
php中有$_REQUEST与$_POST.$_GET用于接受表单数据,当时他们有何种区别,什么时候用那种最好. 一.$_REQUEST与$_POST.$_GET的区别和特点 $_REQUEST[]具 ...
- 419 Battleships in a Board 甲板上的战舰
给定一个二维的甲板, 请计算其中有多少艘战舰. 战舰用 'X'表示,空位用 '.'表示. 你需要遵守以下规则: 给你一个有效的甲板,仅由战舰或者空位组成. 战舰只能水平或者垂直放置.换句话 ...
- Dev之GridControl详解
Dev控件中的表格控件GridControl控件非常强大.不过,一些细枝末节的地方有时候用起来不好找挺讨厌的.使用过程中,多半借助Demo和英文帮助文档.网上具体的使用方法也多半零碎.偶遇一个简单而且 ...
- AJPFX简述java语言现状和发展
作为一种最流行的网络编程语言之一,java语言在当今信息化社会中发挥了 重要的作用.Java语言具有面向对象.跨平台.安全性.多线程等特点,这使得java成为许多应用系统的理想开发语言.java应用在 ...
- hihocoder编程练习赛52-3 部门聚会
思路: 树形dp. 实现: #include <bits/stdc++.h> using namespace std; ; int n, a[MAXN], in[MAXN]; vector ...
- 掌握Spark机器学习库-07-最小二乘法
1)最小化残差平方和 2)原理,推导过程 3)例子
- R Programming week1-Reading Data
Reading Data There are a few principal functions reading data into R. read.table, read.csv, for read ...
- Record these plug-ins of vscode
实在无聊透顶.写个随笔记录一下vscode的插件好了. 第一次使用(之前一直在用sublime...),以后再更新吧.record my color too! Visual Studio Code B ...