hzau 1199 Little Red Riding Hood
1199: Little Red Riding Hood
Time Limit: 1 Sec Memory Limit: 1280 MB
Submit: 918 Solved: 158
[Submit][Status][Web Board]
Description
Once upon a time, there was a little girl. Her name was Little Red Riding Hood. One day, her grandma was ill. Little Red Riding Hood went to visit her. On the way, she met a big wolf. “That's a good idea.”,the big wolf thought. And he said to the Little Red Riding Hood, “Little Red Riding Hood, the flowers are so beautiful. Why not pick some to your grandma?” “Why didn't I think of that? Thank you.” Little Red Riding Hood said.
Then Little Red Riding Hood went to the grove to pick flowers. There were n flowers, each flower had a beauty degree a[i]. These flowers arrayed one by one in a row. The magic was that after Little Red Riding Hood pick a flower, the flowers which were exactly or less than d distances to it are quickly wither and fall, in other words, the beauty degrees of those flowers changed to zero. Little Red Riding Hood was very smart, and soon she took the most beautiful flowers to her grandma’s house, although she didn’t know the big wolf was waiting for her. Do you know the sum of beauty degrees of those flowers which Little Red Riding Hood pick?
Input
The first line input a positive integer T (1≤T≤100), indicates the number of test cases. Next, each test case occupies two lines. The first line of them input two positive integer n and
k (2 <= n <= 10^5 ) ,1 <= k <= n ), the second line of them input n positive integers a (1<=a <=10^5)
Output
Each group of outputs occupies one line and there are one number indicates the sum of the largest beauty degrees of flowers Little Red Riding Hood can pick.
Sample Input
1
3 1
2 1 3
Sample Output
5
HINT
hzau 1199 Little Red Riding Hood的更多相关文章
- HZAU 1199: Little Red Riding Hood 01背包
题目链接:1199: Little Red Riding Hood 思路:dp(i)表示前i朵花能取得的最大价值,每一朵花有两种选择,摘与不摘,摘了第i朵花后第i-k到i+k的花全部枯萎,那么摘的话d ...
- HZAU 1199 Little Red Riding Hood(DP)
Little Red Riding Hood Time Limit: 1 Sec Memory Limit: 1280 MBSubmit: 853 Solved: 129[Submit][Stat ...
- Little Red Riding Hood
问题 : Little Red Riding Hood 时间限制: 1 Sec 内存限制: 1280 MB 题目描述 Once upon a time, there was a little gir ...
- 五、Pandas玩转数据
Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s ...
- 10 分钟学会Linux常用 bash命令
目录 基本操作 1.1. 文件操作 1.2. 文本操作 1.3. 目录操作 1.4. SSH, 系统信息 & 网络操作 基本 Shell 编程 2.1. 变量 2.2. 字符串替换 2.3. ...
- TensorFlow从1到2(五)图片内容识别和自然语言语义识别
Keras内置的预定义模型 上一节我们讲过了完整的保存模型及其训练完成的参数. Keras中使用这种方式,预置了多个著名的成熟神经网络模型.当然,这实际是Keras的功劳,并不适合算在TensorFl ...
- bash guide
Table of Contents Basic Operations 1.1. File Operations 1.2. Text Operations 1.3. Directory Operatio ...
- 华中农业大学第五届程序设计大赛网络同步赛-A
Problem A: Little Red Riding Hood Time Limit: 1 Sec Memory Limit: 1280 MBSubmit: 860 Solved: 133[S ...
- Django Model 数据表
Django Model 定义语法 版本:1.7主要来源:https://docs.djangoproject.com/en/1.7/topics/db/models/ 简单用法 from djang ...
随机推荐
- springcloud zuul
zuul是springcloud的API网关. 入口也是springmvc的DispatcherServlet. 实际的handler是ZuulController,通过handleRequest方法 ...
- CentOS6.9添加环境变量
方法一:直接运行命令export PATH=$PATH:~/.composer/vendor/bin 使用这种方法,只会对当前会话有效,也就是说每当登出或注销系统以后,PATH 设置就会失效,只是临时 ...
- redis性能测试以及影响性能的因素
redis-benchmark测试工具的命令使使用方法及参数如下:redis-benchmark [-h <host>] [-p <port>] [-c <clients ...
- ajax跨域资源共享
一.同域发送数据 略 二.跨域发送数据 1.存在的问题 1.什么是同源策略 同源策略阻止从一个域名上加载的脚本获取或操作另一个域名上的文档属性.也就是说,受到请求的 URL 的域名必须与当前 Web ...
- golang模板语法简明教程(后面有福利哦)
template是go 语言web开发中必不可少的,特此记录下来: [模板标签] 模板标签用"{{"和"}}"括起来 [注释] {{/* a comment ...
- MYSQL:基础—主键
MYSQL:基础—主键 1.什么是主键 表中的每一行都应该具有可以唯一标识自己的一列(或一组列).而这个承担标识作用的列称为主键. 如果没有主键,数据的管理将会十分混乱.比如会存在多条一模一样的记录, ...
- Yii2 使用 Beanstalk 队列系统
参考网址: Beanstalk:https://github.com/kr/beanstalkd Beanstalk console:https://github.com/ptrofimov/bean ...
- Ajax+Spring MVC实现跨域请求(JSONP)
背景: AJAX向后台(springmvc)发送请求,报错:已阻止交叉源请求:同源策略不允许读取 http://127.0.0.1:8080/DevInfoWeb/getJsonp 上的远程资源.可 ...
- [GUI] Linux中的图形管理
转:http://www.cnblogs.com/yongpenghan/p/4555619.html 做了一段时间linux下与QT事件相关的工作,经常会遇到X11,总是苦于无法完全理解其与linu ...
- 在Java中调用Python代码
极少数时候,我们会碰到类似这样的问题:与A同学合作写代码, A同学只会写Python,不熟悉Java ,而你只会写Java不擅长Python,并且发现难以用Java来重写对方的代码,这时,就不得不想方 ...