- 博客(21)
- 收藏
- 关注
原创 poj2777 Count Color
DescriptionChosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem. There is a very long board with length
2016-05-30 20:37:23 457 1
原创 ssl例6(未完成)
在一个N*N的方格中,开始每个格子里的数都是0。现在动态地提出一些问题和修改:提问的形式是求某一个特定的子矩阵(x1,y1)-(x2,y2)中所有元素的和;修改的规则是指定某一个格子(x,y),在(x,y)中的格子元素上加上或者减去一个特定的值A。现在要求你能对每个提问作出正确的回答。1≤N≤1024,提问和修改的总数可能达到60000条。
2016-05-30 20:32:57 380 2
原创 poj3321 Apple Tree
There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree. The tree
2016-05-29 09:09:56 414
原创 ssl例5
一行N个方格,开始每个格子里的数都是0。现在动态地提出一些问题和修改:提问的形式是求某一个特定的子区间[a,b]中所有元素的和;修改的规则是指定某一个格子x,加上或者减去一个特定的值A。现在要求你能对每个提问作出正确的回答。1≤N≤1024,提问和修改的总数可能达到60000条。题解:题目中的区间是以元素为端点,因此[a,b]和[b,c]存在重合,这和我们之前讨论的区间定义不同
2016-05-29 09:02:23 393
原创 POJ3368 Frequent values
DescriptionYou are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ n). Fo
2016-05-22 16:41:15 383
原创 题目(线段树)
线段树:PPT1 例6PKU 3321PKU 3378ZJU 2112ZJU 2334PKU 2777PKU 2828PKU 2812ZJU 2767PKU 3225TYVJ 1659TYVJ 1661TYVJ 1660PKU 2104
2016-05-22 16:21:37 551 6
原创 ssl1033 加分二叉树
Description 设一个n个节点的二叉树tree的中序遍历为(l,2,3,…,n),其中数字1,2,3,…,n为节点编号。每个节点都有一个分数(均为正整数),记第j个节点的分数为di,tree及它的每个子树都有一个加分,任一棵子树subtree(也包含tree本身)的加分计算方法如下: subtree的左子树的加分× subtree的右子树的加分+subtree的根的分数 若某
2016-05-22 16:19:09 401
原创 ssl例五
题目大意:一行N个方格,开始每个格子里的数都是0。现在动态地提出一些问题和修改:提问的形式是求某一个特定的子区间[a,b]中所有元素的和;修改的规则是指定某一个格子x,加上或者减去一个特定的值A。现在要求你能对每个提问作出正确的回答。1≤N≤1024,提问和修改的总数可能达到60000条。题解:为线段树每个节点增加一个Count域。表示所对应区间内元素之和。每次修改
2016-05-22 16:11:35 428
原创 zju1610 Count the Colors
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last.I
2016-05-22 15:59:25 540
原创 ssl例2
题目大意:桌子上零散地放着若干个不同颜色的盒子,桌子的后方是一堵墙。如右图所示。问从桌子前方可以看到多少个盒子?假设人站得足够远(自己设计测试数据,输入时,由底向上,从左到右)。
2016-05-18 20:28:52 473
原创 ssl例1
桌子上零散地放着若干个盒子,桌子的后方是一堵墙。如右图所示。现在从桌子的前方射来一束平行光, 把盒子的影子投射到了墙上。问影子的总宽度是多少?题解:代码:
2016-05-18 16:28:05 487 1
转载 ssl1606 选课
Description 大学里实行学分。每门课程都有一定的学分,学生只要选修了这门课并考核通过就能获得相应的学分。学生最后的学分是他选修的各门课的学分的总和。 每个学生都要选择规定数量的课程。其中有些课程可以直接选修,有些课程需要一定的基础知识,必须在选了其它的一些课程的基础上才能选修。例如,《数据结构》必须在选修了《高级语言程序设计》之后才能选修。我们称《高级语言程序设计》是《数据
2016-05-12 17:01:05 1270 1
原创 ssl1565 将功补过
Description 作为间谍专家的Elvis Han受窃取X星球军事中心的秘密情报,他已经成功进入军事中心。但是很不幸的是,在他还没有找到任务需要情报的时候就被发现,这时他清楚他不可能完成任务了,不过还有机会将功补过,也就是得到一些不如任务情报有价值的其他情报,如果得到的情报的总价值大于等于任务情报价值,他也不会受到惩罚。很幸运的是他已经得到的军事中心的地图,情报都是隐藏在各个道路上的,
2016-05-12 16:52:43 572
原创 ssl1605 二*苹果树
Description有一棵苹果树,如果树枝有分叉,一定是分2叉(就是说没有只有1个儿子的结点) 这棵树共有N个结点(叶子点或者树枝分叉点),编号为1-N,树根编号一定是1。 我们用一根树枝两端连接的结点的编号来描述一根树枝的位置。下面是一颗有4个树枝的树 2 5 \ / 3 4 \ / 1 现在这颗树枝条太多了,需要剪枝。但是一些树枝上长有苹果。 给定需要
2016-05-12 16:20:38 719
原创 pku3013 Big Christmas Tree
DescriptionChristmas is coming to KCM city. Suby the loyal civilian in KCM city is preparing a big neat Christmas tree. The simple structure of the tree is shown in right picture.The tree can
2016-05-08 10:04:34 419
原创 hdu1245 Saving James Bond
Problem DescriptionThis time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to
2016-05-05 17:15:09 596
原创 (待解决)pku3463 Sightseeing
DescriptionTour operator Your Personal Holiday organises guided bus trips across the Benelux. Every day the bus moves from one city S to another city F. On this way, the tourists in the bus can se
2016-05-04 17:57:47 450 1
原创 pk1860 Currency Exchange
DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these curren
2016-05-04 17:41:27 399
原创 pku3259 Wormholes
DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination a
2016-05-04 17:22:54 381
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人