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
hzau 1203 One Stroke的更多相关文章
- HZAU 1203 One Stroke(倍增)
题目链接:http://acm.hzau.edu.cn/problem.php?id=1203 [题意]给你一颗完全二叉树每个节点都有一个权值,然后要你从上往下找一条链,值得链上权值的和<K,且 ...
- 背水一战 Windows 10 (13) - 绘图: Stroke, Brush
[源码下载] 背水一战 Windows 10 (13) - 绘图: Stroke, Brush 作者:webabcd 介绍背水一战 Windows 10 之 绘图 Stroke - 笔划 Brush ...
- iOS 2D绘图 (Quartz2D)之路径(stroke,fill,clip,subpath,blend)
像往常一样 这个系列的博客是跟着大神的脚步来的.按照往例 在此贴出原博客的出处: http://blog.csdn.net/hello_hwc?viewmode=list我对大神的崇拜之情 如滔滔江水 ...
- 题目1203:IP地址
题目: http://ac.jobdu.com/problem.php?pid=1203 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3052 解决:1504 题目描述: 输入一个ip地 ...
- 学习SVG系列(3):SVG Stroke属性
SVG stroke 属性 1.stroke 2.stroke-width 3.stroke-linecap 4.stroke-dasharray 5.stroke-opacity 6.stroke- ...
- [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 ...
- [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 ...
- [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 ...
- [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 ...
随机推荐
- 洛谷 P4109 [HEOI2015]定价
洛谷 这是今天的考试题,我来发一波- 看L和R的范围,显然不能一个一个加,这样会有很多重复情况,会超时,只要看该数有多少个后导0,就把L加上10的多少次方. 很容易可以想到价格后面尽可能多0, 在此基 ...
- rpm命令相关命令运用实例
1) 挂载光盘文件到/media目录 2) 进去/media目录下的Packages目录 3) 查看系统已安装的所有rpm包 4) 查看系统是否安装dhcp软件包 5,安装dhcp软件包 6) 查看d ...
- C语言中的const,free使用方法具体解释
注意:C语言中的const和C++中的const是有区别的,并且在使用VS编译測试的时候. 假设是C的话.请一定要建立一个后缀为C的文件.不要是CPP的文件. 由于.两个编译器会有区别的. 一.C语言 ...
- MySQL学习思维导图
结束:分享在线下载地址 https://www.xmind.net/m/7t6U/
- etl接口测试总结
刚做完一个项目接触到了etl接口,趁还热乎做个总结. etl接口功能测试点总结:1.数据量的检查:目标表与源表数据量是否一致2.字段正确性:拉取源表字段是否为目标表所需要字段(会出现拉错字段情况)3. ...
- 解释*args和**kwargs的含义
当我们不知道向函数传递多少参数时,比如我们向传递一个列表或元组,我们就使用*args def func(*args): for i in args: print(i) func(3,2,1,4,7) ...
- Python 2 一些实用模块的使用
time模块,sys模块,os模块,random模块, shutil模块, json & pickle 模块,re模块 time模块: 在Python中,通常有这几种方式来表示时间:1)时间戳 ...
- 【鸟哥的Linux私房菜】笔记1
Linux是什么 从操作系统与cpu架构关系到linux Richard Mathew Stallman GPL 关于GNU计划 Linux的发展 Linux的核心版本 Linux的特色 Linux ...
- PHP搜索文件夹下全部文件
搜索文件夹下全部文件 //搜索文件夹下全部文件,暂时不支持中文文件名 public function scanFile($path) { if (!is_dir($path)) return arra ...
- 2020年将热门的8大IT职业领域
近日,外媒梳理了未来5年内,也是就是2020年仍将受到热捧的八大科技领域,为IT从业者如何做好长远规划.有针对性地培养自身技能.又不偏离热门岗位提供了参考.(图片来自网易) 2020年将热门的8大IT ...