hzau 1203 One Stroke
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
最新文章
- 关于SQL的相关笔记【长期更新,只发一帖】
- windows phpstudy 本地添加自定义域名
- jQuery1.9为动态添加元素绑定事件以及获取和操作checkbox的选择属性
- Python学习总结14:时间模块datetime &; time &; calendar (一)
- javascript window.confirm确认 取消对话框实现代码小结
- ES6和CommonJS的区别 以及 export和module.exports的区别
- Linux的top命令学习【转载】
- selenium中的alter弹框
- dicom学习文章
- node 跨域请求设置
- CSS定位方法
- [sh]basename&;dirname截取路径和文件名&;case参数选项
- Linux 命令梳理
- python函数传入参数(默认参数、可变长度参数、关键字参数)
- 用Dagger2在Android中实现依赖注入
- SOA 解惑
- 【LOJ】#2268. 「SDOI2017」苹果树
- 【MySQL】MySQL之MySQL常用的函数方法
- java php 等,路径 上级路径,上上级路径表示方法
- [AGC003F] Fraction of Fractal 矩阵快速幂
热门文章
- ng-disabled的使用
- Quartz使用总结(转发:http://www.cnblogs.com/drift-ice/p/3817269.html)
- Tips for Unix/Linux
- iOS AVPlayer 学习
- MySQL 数据库怎样把一个表的数据插入到另一个表
- 配置树莓派3和局域网NTP服务器实现内网时间校准
- [转]u盘读不出来怎么办大汇总
- Logger日志级别说明及设置方法、说明
- 关于IIntelliJ IDEA(2017)安装和破解
- 查看git安装目录