zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    03--软件包管理工具 apt
    02--linux操作系统基础学习笔记
    01--vim常用快捷键
    00--Linux常用命令大全
    07 --C语言字符串函数
    06--C语言数学函数
    (备忘)Rect和RectF的区别
    在android程序中加入widget(窗口小部件)并与之交互的关键代码
    (原)android的alertdialog中加入edittext但是不弹出软键盘等问题的解决与原因
    (转)dp和dip是同一个单位
  • 原文地址:https://www.cnblogs.com/gongpixin/p/6790485.html
Copyright © 2011-2022 走看看