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 ...
随机推荐
- checkmarx使用笔记、原理
checkmarks是一款商业的代码静态分析工具,和pmd类似的地方是他分析的是java文件,而非class文件.checkmarks使用 .net开发,必须安装在windows上,它的规则也是类似. ...
- 软件磁盘阵列(RAID)
RAID软件磁盘阵列 RAID 即廉价磁盘冗余阵列,其高可用性和可靠性适用于大规模环境中,相比正常使用,数据更需要被保护.RAID 是将多个磁盘整合的大磁盘,不仅具有存储功能,同时还有数据保护功能. ...
- VIMTUTOR 1.7中文版
文章来源:http://waterxfire.blog.hexun.com/4106986_d.html =============================================== ...
- 内置函数(Day16)
现在python一共为我们提供了68个内置函数.它们就是python提供给你直接可以拿来使用的所有函数 内置函数 abs() divmod() input() open() stati ...
- python并发编程之多线程2---(死锁与递归锁,信号量等)
一.死锁现象与递归锁 进程也是有死锁的 所谓死锁: 是指两个或两个以上的进程或线程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用, 它们都将无法推进下去.此时称系统处于死锁状态或系统 ...
- Java访问网络url,获取网页的html代码
在Java中,Java.net包里面的类是进行网络编程的,其中,java.net.URL类和java.net.URLConection类是编程者方便地利用URL在Internet上进行网络通信.有两种 ...
- 对象数组空指针异常说明——C#中使用对象数组必须分别为其开辟空间
l 场景 定义一个学生类,包含字段(学号,姓名,语文成绩,数学成绩,英语成绩).属性(总成绩).三个方法分别为(求平均分.数学平均分.语文平均分). 要求:在main()方法中,定义一个学生类型的数 ...
- java 图片转换工具
package com.sicdt.sicsign.web.utils; import java.awt.Graphics2D; import java.awt.image.BufferedImage ...
- pppoe白皮书
转:https://blog.csdn.net/achejq/article/details/19478811 PPPoE技术白皮书 关键词:PPP,Ethernet,PPPoE 摘 要:PPP ...
- 【Head First Servlets and JSP】笔记4:HttpServletRequest req
api:https://tomcat.apache.org/tomcat-5.5-doc/servletapi/ 1.GET和POST除去数据大小之外的区别. 安全性问题.使用GET的话,参数数据会出 ...