09 2017 档案
摘要:“学习本无底,前进莫徬徨。” 秋实大哥对一旁玩手机的学弟说道。 秋实大哥是一个爱学习的人,今天他刚刚学习了线段树这个数据结构。 为了检验自己的掌握程度,秋实大哥给自己出了一个题,同时邀请大家一起来作。 秋实大哥的题目要求你维护一个序列,支持两种操作:一种是修改某一个元素的值;一种是询问一段区间的和。
阅读全文
摘要:链表允许我们添加、删除、搜索数据,这种数据结构会在执行时申请必要的内存空间,便于管理动态集合。但是链表的时间复杂度为O(n)。相比之下,使用动态树结构能更加有效地添加、删除和搜索数据。 搜索树是一种可以进行动态插入、搜索、删除等操作的数据结构,可以用作字典或优先级队列。二叉搜索树属于最基本的搜索树。
阅读全文
摘要:Binary trees are defined recursively. A binary tree T is a structure defined on a finite set of nodes that either contains no nodes, or is composed of
阅读全文
摘要:A rooted binary tree is a tree with a root node in which every node has at most two children. Your task is to write a program which reads a rooted bin
阅读全文
摘要:建立新的编译系统 Tools->Build System->New Build System 在打开的页面中粘贴以下代码 保存文件(ctrl+s),并且取一个自己喜欢的名字,(后缀名不要改),在Tools->Build System中选择即可。
阅读全文
摘要:最长上升子序列问题,也就是Longest increasing subsequence,缩写为LIS。是指在一个序列中求长度最长的一个上升子序列的问题,是动态规划中一个相当经典问题。上升子序列指的是对于任意的i<j都是满足ai<aj的子序列。 定义dp[i]:=以ai为末尾的最长上升子序列的长度 以
阅读全文
摘要:Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this
阅读全文
摘要:Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N ≤ 1,000,00
阅读全文
摘要:A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edges. Fig. 1 illus
阅读全文
摘要:在32位及以上操作系统上,int型数据的十进制表示范围是:-231 到 231-1。原因:因为int是带符号类型,所以最高位为符号位,于是最大表示的正数的原码(正数的原码和补码相同):01111111 11111111 11111111 11111111,也就是2的31次方减1。再来看最小值,-2的
阅读全文
摘要:电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。 某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的
阅读全文
摘要:It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of
阅读全文
摘要:Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power
阅读全文
摘要:要枚举n以内的素数,可以用埃氏筛法。这是一个与辗转相除法一样古老的算法。 首先,将2到n范围内的所有整数写下来。其中最小的数字2是素数。将表中所有2的倍数都划去。表中剩余的最小数字是3,它不能被更小的数整除,所以是素数。再将表中所有3的倍数全都划去。依次类推,如果表中剩余的最小数字是m时,m就是素数
阅读全文
摘要:01 背包问题 有n个重量和价值分别为wi和vi的物品。从这些物品中挑选出总重量不超过W的物品,求所有挑选方案中总价值总和的最大值。 这是被称为背包问题的一个著名的问题。01 背包是背包问题的其中一种,对于任意一个物品,可以选择0个(不选)和1个。 其实我们还可以讲两个数组滚动使用来实现重复使用。例
阅读全文
摘要:Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤
阅读全文
摘要:Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other o
阅读全文
摘要:FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells one treat per day and wants to m
阅读全文
摘要:A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another
阅读全文

浙公网安备 33010602011771号