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的更多相关文章

  1. HZAU 1199: Little Red Riding Hood 01背包

    题目链接:1199: Little Red Riding Hood 思路:dp(i)表示前i朵花能取得的最大价值,每一朵花有两种选择,摘与不摘,摘了第i朵花后第i-k到i+k的花全部枯萎,那么摘的话d ...

  2. HZAU 1199 Little Red Riding Hood(DP)

    Little Red Riding Hood Time Limit: 1 Sec  Memory Limit: 1280 MBSubmit: 853  Solved: 129[Submit][Stat ...

  3. Little Red Riding Hood

    问题 : Little Red Riding Hood 时间限制: 1 Sec  内存限制: 1280 MB 题目描述 Once upon a time, there was a little gir ...

  4. 五、Pandas玩转数据

    Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s ...

  5. 10 分钟学会Linux常用 bash命令

    目录 基本操作 1.1. 文件操作 1.2. 文本操作 1.3. 目录操作 1.4. SSH, 系统信息 & 网络操作 基本 Shell 编程 2.1. 变量 2.2. 字符串替换 2.3. ...

  6. TensorFlow从1到2(五)图片内容识别和自然语言语义识别

    Keras内置的预定义模型 上一节我们讲过了完整的保存模型及其训练完成的参数. Keras中使用这种方式,预置了多个著名的成熟神经网络模型.当然,这实际是Keras的功劳,并不适合算在TensorFl ...

  7. bash guide

    Table of Contents Basic Operations 1.1. File Operations 1.2. Text Operations 1.3. Directory Operatio ...

  8. 华中农业大学第五届程序设计大赛网络同步赛-A

    Problem A: Little Red Riding Hood Time Limit: 1 Sec  Memory Limit: 1280 MBSubmit: 860  Solved: 133[S ...

  9. Django Model 数据表

    Django Model 定义语法 版本:1.7主要来源:https://docs.djangoproject.com/en/1.7/topics/db/models/ 简单用法 from djang ...

随机推荐

  1. ThinkPHP的create方法的一系列操作

    1.数据操作状态 create方法的第二个参数可以指定数据的操作状态,默认是自动判断的(写入[Model:MODEL_INSERT或者1].更新[Model:MODEL_UPDATE或者2].也可以自 ...

  2. DOM 常见事件

    onclick //当用户点击某个对象时调用的事件句柄. ondblclick //当用户双击某个对象时调用的事件句柄. onfocus //元素获得焦点. onblur //元素失去焦点. 应用场景 ...

  3. Springboot入门2-配置druid

    Druid是Java语言中最好的数据库连接池,在连接池之外,还提供了非常优秀的监控功能. 下面来说明如何在 Spring Boot 中配置使用Druid 1.添加Maven依赖 (或jar包) < ...

  4. Oracle学习笔记—数据字典和常用命令(转载)

    转载自: oracle常用数据字典和SQL语句总结 Oracle常用命令大全(很有用,做笔记) 一.Oracle数据字典 数据字典是Oracle存放有关数据库信息的地方,其用途是用来描述数据的.比如一 ...

  5. node.js及node-inspector的调试方法

    1.先运行 $ node --debug-brk test.js 2.再在新的窗口运行: $ node-inspector 3.再打开Chrome浏览器输入node-inspector提示的地址,就会 ...

  6. Logstash简介

    支持多种数据获取机制,通过TCP/UDP协议.文件.syslog.windows.EventLogs及STDIN等:获取到数据口,支持对数据进行过滤.修改等操作JRuby语言研发,工作在JVM中   ...

  7. python之网络socket编程

    一.网络协议 客户端/服务器架构 1.硬件C/S架构(打印机) 2.软件C/S架构(互联网中处处是C/S架构):B/S架构也是C/S架构的一种,B/S是浏览器/服务器 C/S架构与socket的关系: ...

  8. image has dependent child images

    在删除镜像之前要先用 docker rm 删掉依赖于这个镜像的所有容器(哪怕是已经停止的容器),否则无法删除该镜像. 停止容器 # docker stop $(docker ps -a | grep ...

  9. Loadrunder脚本篇——webservice接口测试(二)

    1.选择协议--Web Service,如下图 2.导入服务 入口1:点击Manage Services ->弹出窗中选择“Import” ->弹出窗中选择“URL”,填写wsdl地址,导 ...

  10. VC:res协议——从模块中获取资源

    你可以从模块中获取一个资源.通过在文件名之前加上res://,你就可以引用一个嵌入在动态链接库资源文件中的HTML页面.