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个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
随机推荐
- APP热修复
APP热修复的概念: APP修复是针对修复app中的bug场景来定义的.当我们已上线的app出现bug的时候,我们想在用户不知情的情况下修复这个bug,那么就会用到热修复. APP热修复的实现原理: ...
- D. Mahmoud and a Dictionary 种类并查集
http://codeforces.com/contest/766/problem/D 所谓种类并查集,题型一般如下:给定一些基本信息给你,然后又给出一些信息,要求你判断是真是假.例如给出a和b支持不 ...
- android开发学习——Socket发送和接收
client -- server发送过程中,涉及的输入流输出流: http://blog.csdn.net/dlwh_123/article/details/35982015 (良心好文) 需 ...
- vue采坑及较好的文章汇总
1:父子组件传动态传值 https://www.cnblogs.com/daiwenru/p/6694530.html -----互传数据基本流程 https://blog.csdn.net/qq_ ...
- (五)SpringIoc之Bean的作用域
此文转自 https://blog.csdn.net/icarus_wang/article/details/51586776# 有状态bean和无状态bean请看 https://blog.csdn ...
- Hibernate配置详解
<!--标准的XML文件的起始行,version='1.0'表明XML的版本,encoding='gb2312'表明XML文件的编码方式--> <?xml version='1.0' ...
- iOS 中集成海康威视 摄像视频
本文原文地址 http://www.cnblogs.com/qianLL/p/6652104.html 一.要导入相关的库,注意 这里比较坑的是 要用和他一样的 如果开始的工程中用了AFN或者MJE ...
- 提高SQL查询效率 的10大方法
一.查询条件精确,针对有参数传入情况 二.SQL逻辑执行顺序 FROM–>JOIN–>WHERE–>GROUP–>HAVING–>DISTINCT–>ORDER–& ...
- oauth 理解
单点登录 对授权码模式的解读. 1. 用户访问客户端,客户端将请求认证服务器. 2. 用户选择是否给予客户端授权 3.用户授权后,认证服务器将用户导向客户端事先定义好的重定向的地址,同时会附上一个授权 ...
- C# GDI+ 画坐标(x,y)
private void button1_Click(object sender, EventArgs e) { Graphics g = this.CreateGraphics(); g.Clear ...