1203: One Stroke

Time Limit: 2 Sec  Memory Limit: 1280 MB
Submit: 264  Solved: 56
[Submit][Status][Web Board]

Description

There is a complete binary tree which includes n nodes. Each node on the tree has a weight w, each edge on the tree is directed from the parent node to the child node. Give you a pen, draw from the any node along the directed edge at one stroke. It is required that the sum of those drawn nodes’ s weight is no more than k. How many node can be drawn at most in one stroke?

Input

The first line input an positive integer T(1<=T<=10)indicates the number of test cases. Next, each case occupies two lines. The first line input two positive integers n(1<=n<=10^6) and k,(1<=k<=10^9)

The second line input n integers w(1<=w <=10^3),, indicate the weight of nodes from the first level of the tree and from left to right.

Output

For each test cases, output one line with the most number of nodes can be drawn in one stroke. If any node likes this doesn’t exists, output -1.

Sample Input

1
5 6
2 3 4 1 7

Sample Output

3

HINT

 
 
 
 
 

hzau 1203 One Stroke的更多相关文章

  1. HZAU 1203 One Stroke(倍增)

    题目链接:http://acm.hzau.edu.cn/problem.php?id=1203 [题意]给你一颗完全二叉树每个节点都有一个权值,然后要你从上往下找一条链,值得链上权值的和<K,且 ...

  2. 背水一战 Windows 10 (13) - 绘图: Stroke, Brush

    [源码下载] 背水一战 Windows 10 (13) - 绘图: Stroke, Brush 作者:webabcd 介绍背水一战 Windows 10 之 绘图 Stroke - 笔划 Brush ...

  3. iOS 2D绘图 (Quartz2D)之路径(stroke,fill,clip,subpath,blend)

    像往常一样 这个系列的博客是跟着大神的脚步来的.按照往例 在此贴出原博客的出处: http://blog.csdn.net/hello_hwc?viewmode=list我对大神的崇拜之情 如滔滔江水 ...

  4. 题目1203:IP地址

    题目: http://ac.jobdu.com/problem.php?pid=1203 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3052 解决:1504 题目描述: 输入一个ip地 ...

  5. 学习SVG系列(3):SVG Stroke属性

    SVG stroke 属性 1.stroke 2.stroke-width 3.stroke-linecap 4.stroke-dasharray 5.stroke-opacity 6.stroke- ...

  6. [javascript svg fill stroke stroke-width points polygon属性讲解] svg fill stroke stroke-width points polygon绘制多边形属性并且演示polyline和polygon区别讲解

    <!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...

  7. [javascript svg fill stroke stroke-width points polyline 属性讲解] svg fill stroke stroke-width points polyline 绘制折线属性讲解

    <!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...

  8. [javascript svg fill stroke stroke-width x1 y1 x2 y2 line stroke-opacity fill-opacity 属性讲解] svg fill stroke stroke-width stroke-opacity fill-opacity line绘制线条属性讲解

    <!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...

  9. [javascript svg fill stroke stroke-width x y rect rx ry 属性讲解] svg fill stroke stroke-width rect 绘制具有圆角矩形属性讲解

    <!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...

随机推荐

  1. win8内置管理员账号既能使用metro应用又能使用默认共享

    一.内置管理员账号打开METRO应用 1.按WIN+R 弹出运行框. 2.输入gpedit.msc点确定,打开本地组策略编辑器. 3.逐级选择“计算机配置”,“Windows 设置”,“安全设置”,“ ...

  2. swift笔记——环境搭建及Hello,Swift!

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/enson16855/article/details/29829601 首先要下载XCode6,仅仅有 ...

  3. 用数据池来实现socket并发

    最终目标:启动服务后可以有无数个访问,并且可以随时输入,服务端使用进程池. 服务端 from socket import * import os,time from concurrent.future ...

  4. 顽石系列:Linux基础笔试

    顽石系列:Linux基础笔试 系统操作 压缩文件 扩展名 压缩程序 *.Z compress *.zip zip *.gz gzip *.bz2 bzip2 *.xz xz *.tar tar 程序打 ...

  5. des加密——补齐

    下面这个网址(英文)介绍的比较全面. http://www.di-mgt.com.au/cryptopad.html

  6. Hibernate多对多关联

    多对多关联: 示例:Teacher和Student,一个Teacher可以教很多student,一个Student也可以被很多teacher教   多对多单向关联 Teacher知道自己教了哪些学生, ...

  7. $《第一行代码:Android》读书笔记——第2章 Activity

    (一)创建活动 1.创建活动类 创建没有Activity的项目,发现src文件夹是空的,手动创建一个包com.jyj.demo1,在包中添加一个名为MainActivity的class,该MainAc ...

  8. [转]springmvc中的常用的返回

    package com.boventech.learning.controller; import java.util.HashMap; import java.util.Map; import or ...

  9. Android驱动开发全过程(有图有真相)

    转:https://wenku.baidu.com/view/349bd159b7360b4c2e3f64b1.html

  10. Cocos2d-x项目移植到WP8系列之六:C#工程使用C++的DLL

    原文链接: http://www.cnblogs.com/zouzf/p/3984510.html 此时,一些大问题都被解决后,整个工程基本能跑起来了,最后一个大问题是:业务层是用Lua开发的,底层的 ...