
树
文章平均质量分 84
浪流人
这个作者很懒,什么都没留下…
展开
-
第5周 线段树 树状数组
E - 敌兵布阵C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以Tidy要随时向Derek汇报某一段连续的工兵营地一共有多少人,例如Derek问:“Tidy,原创 2020-09-27 20:14:41 · 331 阅读 · 0 评论 -
A Simple Problem with Integers POJ - 3468 线段树,数状数字
You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the sum of numbers in a given interval.InputThe first line c原创 2020-10-05 17:55:39 · 113 阅读 · 0 评论 -
Mayor‘s posters
The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally decided to build an electoral wall for placing the poster原创 2021-01-24 20:21:41 · 200 阅读 · 0 评论 -
求哈夫曼数的带权路径长度及编码
给出叶子节点,输出带权路径长度#include<queue>#include<stdio.h>using namespace std;priority_queue<int,vector<int>,greater<int> >q;int main(){ int n,x,i; scanf("%d",&n);//叶子节点个数 for(i=0;i<n;i++) { scanf("%d",&x原创 2020-10-30 17:11:11 · 493 阅读 · 0 评论 -
C - 求先序 计蒜客 - T2113
给出一棵二叉树的中序与后序排列。求出它的先序排列。(约定树结点用不同的大写字母表示,长度 \le≤ 88)。输入格式22 行,均为大写字母组成的字符串,表示一棵二叉树的中序与后序排列。输出格式11 行,表示一棵二叉树的先序。输出时每行末尾的多余空格,不影响答案正确性样例输入BADCBDCA样例输出ABCD#include<stdio.h>#include<...原创 2020-04-28 21:29:33 · 125 阅读 · 0 评论 -
Tree Recovery求后序
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes.This is an example of one of her creatio...原创 2020-04-28 20:32:19 · 148 阅读 · 0 评论 -
hdu 5.2.7 1053 Entropy
An entropy encoder is a data encoding method that achieves lossless data compression by encoding a message with “wasted” or “extra” information removed. In other words, entropy encoding removes inform...原创 2020-04-23 20:37:38 · 263 阅读 · 0 评论 -
Fence Repair POJ - 3253
Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer length Li (1 ≤ Li ...原创 2020-04-21 20:15:23 · 261 阅读 · 0 评论