线段树+二分区间
用线段树维护某一段内还有多少个花瓶可以用,二分确定插入的左右界.....
Vases and Flowers
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 1782 Accepted Submis...
分类:
其他好文 时间:
2014-07-22 23:05:54
阅读次数:
307
竟然做过原题,一眼看上去竟然没感觉。。。
哈夫曼树定义:给定n个权值作为n个叶子结点,构造一棵二叉树,若带权路径长度达到最小,称这样的二叉树为最优二叉树,也称为哈夫曼树(Huffman tree)。哈夫曼树是带权路径长度最短的树,权值较大的结点离根较近。
1、路径和路径长度
在一棵树中,从一个结点往下可以达到的孩子或孙子结点之间的通路,称为路径。通路中分支的数目称为路径长度。若规...
分类:
其他好文 时间:
2014-07-22 22:59:32
阅读次数:
293
BFS。wa了一下午,原来是YES,写成了Yes。 1 #include 2 #include 3
#include 4 #include 5 using namespace std; 6 7 typedef struct node_st{ 8 int x,
y; 9 in...
分类:
其他好文 时间:
2014-05-06 08:48:16
阅读次数:
274
Given a binary tree containing digits from 0-9
only, each root-to-leaf path could represent a number.An example is the
root-to-leaf path 1->2->3 which...
分类:
其他好文 时间:
2014-05-05 23:55:36
阅读次数:
407
sed‘s/^/\//g‘4行首增加指定字符提取网页中的播放地址:#!/bin/bash
printf"enteryourdir:"
readdir
echo"$dirisxx"
cd$dir
echo`pwd`
forfilein`ls.`
do
if[-d$file];then
echo$file
cd$file
echo`pwd`
tree`pwd`|grepplay|sed‘s/.*//g‘>11
tree`pwd`|grepplay|sed‘s/.*//g..
分类:
其他好文 时间:
2014-05-03 00:53:15
阅读次数:
336
2sat.... 队长离开时两个队员必须同时留下,两个队员中只要有人离开队长就得留下...
Let's go home
Time Limit: 10000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1304 Accepted Submissio...
分类:
其他好文 时间:
2014-05-02 23:43:54
阅读次数:
501
QUE:线段树?称谓:从刘汝佳的书中得知,“这种数据结构在学术界没有统一的术语,但线段树是最常见的叫法。其他叫法包括区间树(interval
tree)、范围树(range
tree)等,但这些属于在特定的场合(如计算几何)中有着特殊的意义”。怎么叫看读者的心情,以下统一用线段树称呼。先来作一些了解...
分类:
其他好文 时间:
2014-05-02 16:21:56
阅读次数:
347
Given a binary tree, determine if it is a valid
binary search tree (BST).Assume a BST is defined as follows:The left subtree of
a node contains only n...
分类:
其他好文 时间:
2014-05-02 15:03:57
阅读次数:
386
Given a binary tree, determine if it is
height-balanced.For this problem, a height-balanced binary tree is defined as a
binary tree in which the depth...
分类:
其他好文 时间:
2014-05-02 07:05:08
阅读次数:
311
看Discuss说是博弈论,没学到这个分类。不过仔细想了想,发现。如果m 2 3 int main()
{ 4 int m, n; 5 int i; 6 7 while (scanf("%d %d", &m, &n) != EOF) { 8 if
(m <...
分类:
其他好文 时间:
2014-05-01 19:38:17
阅读次数:
368