- 博客(78)
- 收藏
- 关注
原创 数据结构之哈夫曼编码,哈夫曼树
哈夫曼编码原理请自行百度,仅贴上本咸鱼的代码与运行截图//By Sean Chen#include #include #include #include #include #include #include #include using namespace std;class treenode{public: char data; int num; treenod
2017-04-27 22:42:04
388
原创 POJ 2387 最短路 贝尔曼福特和迪杰斯特拉双解
Til the Cows Come HomeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 52016 Accepted: 17570DescriptionBessie is out in the field and wants to get back to
2017-04-25 22:28:12
497
原创 POJ 1308 判断是否为一颗树
Is It A Tree?Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 32211 Accepted: 10925DescriptionA tree is a well-known data structure that is either empty (n
2017-04-23 11:59:41
362
原创 POJ 1990 树状数组
弱第一次知道了树状数组与线段树的差别。。。。实在太弱了。言归正传:题目:MooFestTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 7683 Accepted: 3455DescriptionEvery year, Farmer Jo
2017-04-22 00:16:46
237
原创 POJ 3250 Bad Hair Day 算法学习:单调栈
Bad Hair DayTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 18534 Accepted: 6266DescriptionSome of Farmer John's N cows (1 ≤ N ≤ 80,000) are having a ba
2017-04-17 21:06:14
400
原创 POJ 2674 Linear World
题目:Linear worldTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 3665 Accepted: 825DescriptionThe Disc, being flat, has no real horizon. Any adventuro
2017-04-17 12:03:05
403
原创 PAT L3-003社交集群 (并查集)
题目:在社交网络平台注册时,用户通常会输入自己的兴趣爱好,以便找到和自己兴趣相投的朋友。有部分兴趣相同的人们就形成了“社交集群”。现请你编写程序,找出所有的集群。输入格式:输入的第一行给出正整数N(Ki: hi[1] hi[2] ... hi[Ki]其中Ki(>0)是第i个人的兴趣的数量,hi[j]是第i个人的第j项兴趣的编号,编号范围为[1, 1000]内的整数。输出
2017-04-09 11:52:52
285
原创 PAT L2-006 树的遍历
题目:给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历的序列。这里假设键值都是互不相等的正整数。输入格式:输入第一行给出一个正整数N(输出格式:在一行中输出该树的层序遍历的序列。数字间以1个空格分隔,行首尾不得有多余空格。输入样例:72 3 1 5 7 6 41 2 3 4 5 6 7输出样例:4 1 6 3 5 7 2思路:树
2017-04-07 10:59:47
363
原创 The Water Bowls POJ 3185
The cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing cool water) or upside-down (a position which holds no water).
2017-04-01 12:04:18
334
原创 HDU 2669 算法学习:exgcd 拓展欧几里得
题目:RomanticTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5762 Accepted Submission(s): 2456Problem DescriptionThe Sky is Sprit
2017-03-29 20:41:03
428
原创 cf 573B Bear and Blocks 小小的脑洞题
题目:B. Bear and Blockstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLimak is a little bear who loves
2017-03-15 19:21:20
402
原创 PTA C4 L3-010 树状数组
题目:L3-010. 是否完全二叉搜索树时间限制 400 ms内存限制 65536 kB代码长度限制 8000 B判题程序 Standard 作者 陈越将一系列给定数字顺序插入一个初始为空的二叉搜索树(定义为左子树键值大,右子树键值小),你需要判断最后的树是否一棵完全二叉树,并且给出其层
2017-03-11 21:31:13
326
原创 Lightoj 1307 二分
题目:You are given N sticks having distinct lengths; you have to form some triangles using the sticks. A triangle is valid if its area is positive. Your task is to find the number of ways you can form
2017-03-09 09:42:48
281
原创 POJ 1270 Following Orders
DescriptionOrder is an important concept in mathematics and in computer science. For example, Zorn's Lemma states: ``a partially ordered set in which every chain has an upper bound contains a maxima
2017-02-28 21:18:29
376
原创 POJ 3020 Antenna Placement 匈牙利算法变形
DescriptionThe Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most striking reason why they got the job, is their disco
2017-02-19 12:40:59
525
原创 HDU 2063 过山车 算法学习:匈牙利算法
题目:Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,Prince
2017-02-16 22:27:21
298
原创 POJ 3268 Silver Cow Party 最短路
题目:DescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤X ≤ N). A total of M (1 ≤ M ≤ 100,000) uni
2017-02-15 22:39:18
212
原创 poj 3026 Borg Maze dfs+prim
题目:DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the
2017-02-15 17:19:33
279
原创 POJ 2184 Cow Exhibition 01背包
一道01背包的变形,挺有趣的题:题目:Description"Fat and docile, big and dumb, they look so stupid, they aren't muchfun..."- Cows with Guns by Dana LyonsThe cows want to prove to the public that they
2017-02-10 23:09:07
315
原创 poj 3140 Contestants Division DFS
原题:DescriptionIn the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and students will be able to compete at their own universities. However there’s one
2017-02-08 17:36:47
518
原创 POJ 1190 生日蛋糕 搜索加剪枝
题目:Description7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。设从下往上数第i(1 Ri+1且Hi > Hi+1。由于要在蛋糕上抹奶油,为尽可能节约经费,我们希望蛋糕外表面(最下一层的下底面除外)的面积Q最小。令Q = Sπ请编程对给出的N和M,找出蛋糕的制作方案(适当的Ri和Hi的值),使S最小。(
2017-02-05 12:02:24
296
原创 poj 1189 钉子和小球 一道有趣的题
一道有趣的题,不算难。题目:Description有一个三角形木板,竖直立放,上面钉着n(n+1)/2颗钉子,还有(n+1)个格子(当n=5时如图1)。每颗钉子和周围的钉子的距离都等于d,每个格子的宽度也都等于d,且除了最左端和最右端的格子外每个格子都正对着最下面一排钉子的间隙。让一个直径略小于d的小球中心正对着最上面的钉子在板上自由滚落,小球每碰到一个钉子都可能落向左边或
2017-02-04 22:56:59
482
原创 算法学习 POJ 1751 highways 最小生成树
题目:DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has alread
2017-02-03 13:33:59
258
原创 HDU 1166 敌兵布阵 算法学习:线段树
题目:Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过
2017-02-01 20:39:51
335
原创 HDU 1428 记忆化搜索
题目:Problem DescriptionLL最近沉迷于AC不能自拔,每天寝室、机房两点一线。由于长时间坐在电脑边,缺乏运动。他决定充分利用每次从寝室到机房的时间,在校园里散散步。整个HDU校园呈方形布局,可划分为n*n个小方格,代表各个区域。例如LL居住的18号宿舍位于校园的西北角,即方格(1,1)代表的地方,而机房所在的第三实验楼处于东南端的(n,n)。因有多条路线可以选
2017-02-01 17:10:53
312
原创 POJ 2566 BOUND FOUND 尺取法
题目:Signals of most probably extra-terrestrial origin have been received and digitalized by The Aeronautic and Space Administration (that must be going through a defiant phase: "But I want to use f
2017-02-01 15:59:19
307
原创 poj1606 Jugs
第一次做bfs+路径的题。。小白一个,代码略复杂。不过个人觉得思路还是很清楚的原题:DescriptionIn the movie "Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted with the following puzzle. They were given a 3-gallon jug and
2017-01-25 21:49:08
314
原创 2016 小灶1 K (poj2236)
题目:An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers i
2017-01-15 15:25:52
419
原创 算法学习:拓扑排序(poj1094)
所谓拓扑排序,即在有向图中,找出一个没有入度的点,将他与他所有的出度从图中删去(即所有与它相连的点的入度-1)直到所有点被输出或找不到入度为零的点为止。例:题目:POJ1094An ascending sorted sequence of distinct values is one in which some form of a less-than operator is u
2017-01-15 13:16:44
334
原创 2016 小灶1 J (poj2503)
题目:You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.In
2017-01-15 13:07:45
652
原创 2016 小灶1 H (HDU1896)
题目:Because of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a little tired, so Sempr always play some games this ti
2017-01-15 12:49:42
599
原创 2016 小灶1 G (POJ1456)
题目:A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the mom
2017-01-15 12:31:56
328
原创 2016 小灶1 F (POJ2635)
题目:The young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of users, which is now in use in his company. The cryptographic keys are
2017-01-15 10:43:29
393
原创 2016 小灶练习 E (HDU1263)
题目:夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了. Input第一行正整数N(0每组测试数据的第一行是一个整数M(0<M<=100),表示工有M次成功的交易.其后有M行数据,每行表示一次交易,由水果名称(小写字母组
2017-01-15 10:35:34
396
原创 2016 小灶1 D题 (HDU1019)
题目:The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105.
2017-01-14 22:37:37
274
原创 2016 小灶1 C题 (HDU1225)
题目:Football is one of the greatest games in the world. Lots of people like to play football. After one season of matches, the header has to calculate the last scores of every team. He is too lazy
2017-01-14 22:28:54
421
原创 2016 小灶练习 B (HDU1228)
题目:读入两个小于100的正整数A和B,计算A+B.需要注意的是:A和B的每一位数字由对应的英文单词给出. Input测试输入包含若干测试用例,每个测试用例占一行,格式为"A + B =",相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出. Output对每个测试用例输出1行,即A+B的值. Sa
2017-01-14 22:23:53
377
原创 2016 小灶练习1 A题 (HDU1034)
题目:A number of students sit in a circle facing their teacher in the center. Each student initially has an even number of pieces of candy. When the teacher blows a whistle, each student simultaneousl
2017-01-14 22:09:14
834
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人