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个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
随机推荐
- Android推送服务(2)微信智能心跳方案
http://mp.weixin.qq.com/s?__biz=MzAwNDY1ODY2OQ==&mid=207243549&idx=1&sn=4ebe4beb8123f1b5 ...
- ABBYY Cup 3.0 - Finals (online version)
A 开个数组记录一下 #include <iostream> #include<cstdio> #include<cstring> #include<algo ...
- android开发学习——android studio 引入第三方库的总结
http://www.jianshu.com/p/0c592fff5d89 总结的很溜
- (二)Spring容器
大佬总结的很好,请去看大佬博客. http://www.cnblogs.com/chenssy/archive/2012/11/15/2772287.html https://www.cnblogs. ...
- SpringBoot 2.x (2):请求和传参
其实请求和传参这些知识属于SpringMVC 不过这也属于必须掌握的知识,巩固基础吧 GET请求: 以第一篇文章自动的方式创建SpringBoot项目: 然后新建Controller: package ...
- 快速排序算法原理及其js实现
要说快排的原理,通俗点说就是把一个事情,分成很多小事情来处理,分治的思想. 假设我们现在对“6 1 2 7 9 3 4 5 10 8”这10个数进行排序.首先在这个序列中随便找一个数作为 ...
- InChatter系统开源聊天模块前奏曲
最近在研究WCF,又因为工作中的项目需要,要为现有的系统增加一个聊天模块以及系统消息提醒等,因此就使用WCF做服务器端开发了一个简单的系统. 开发最初学习了东邪孤独大哥的<传说的WCF系列> ...
- JavaScript——XMLHttpRequest 家族
https://www.zhangxinxu.com/wordpress/2013/10/understand-domstring-document-formdata-blob-file-arrayb ...
- redis-cli 工具--raw参数的作用
最近阅读了以redis官网关于--raw参数的解释,其功能有两个: 1.按数据原有格式打印数据,不展示额外的类型信息 例如:使用命令发送方式(redis在使用时有命令发送方式和交互方式两种)创建一个k ...
- swift class extension 与继承
1.扩展中无法继承重写已有函数,不能添加函数. Extensions can add new functionality to a type, but they cannot override exi ...