自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 资源 (2)
  • 收藏
  • 关注

原创 hdu 1823 Luck and Love 二维线段树

第一次写二维线段树,题目算是简单,就是很多的陷阱;题意比较的简单,就不说了;二维线段树:就是在线段树里面嵌套一个线段树,可是由于结构的原因,一层线段树必须更新到底。如果各位大神有在一维不更新到底的方法,请提出来,我一定改正!代码:#include #include #include #include using namespace std;#define maxn 1

2013-04-11 09:31:55 400

原创 hdoj 4287 Intelligent IME 字典树

2012天津赛区网络赛的题,当年被一个大一的学弟A了,今天重温数据结构,做了一下,水题,没多大意义!不能用数字来匹配单词,那样复杂度太大,反过来比较简单!#include #include #include using namespace std;struct node{ int m; node *next[10]; int su; node(

2013-03-12 09:17:07 799

原创 hdoj 1671Phone List 字典树

题目有个陷阱:我的思路是如果走到了某个字符串的结尾,那就跳出循环!结果光荣WA了。如果这个字符串的结尾被走过了,那么也要跳出!#include #include #include #include using namespace std;struct node{ int m; int v; node *next[10]; node()

2013-03-11 21:32:39 815

原创 POJ 2418 Hardwood Species 二叉搜索树

题目大意:给你很多的树的名称,名称有很多是相同的,请你按字典树输出它们,以及它们所占的比例比较简单,就不多说了,按理来说这个题目用map会简单很多,但是为了锻炼一下二叉搜索树的写法,自己写了一次!#include #include #include #include #include using namespace std;struct node{ char s[50

2013-03-11 19:42:18 404

原创 POJ 1200 Crazy Search

Rabin-Karp算法题目的测试数据不够强大,太水了,我写的代码有两个地方是有问题的1:我没有确定一个取模的限度,也就是说没有取模,如果测试数据够强,肯定出问题,但是这里又牵扯出一个问题,如果我在每一次相乘的时候取模,使之保证在一个限度,那么我得到的哈希值与字符串是否还对应?我认为是对应的!2:我没有处理冲突,这个地方应该是要处理冲突的,建议使用拉链法处理冲突。 #include

2013-03-02 12:20:18 220

原创 POJ 2503 Babelfish

ELFHash算法一看就是个水题,很多方法可以解,最简单的就应该是用map,但是出题的正解应该是使用ELFHash算法。处理冲突,我们用拉链法 #include #include #include #include using namespace std;#define MAXN 1000003struct node{ char m[11]; c

2013-03-01 21:07:47 187

原创 hdoj 1430魔板

此题主要考察的是BFS预处理+hash,hash用了康托展开,其中比较纠结的是按字典序进行排序,我一直没弄懂这个地方怎么做,后来看了傻仔大神的解题报告http://www.cppblog.com/notonlysuccess/archive/2009/02/27/75087.aspx#include #include #include #include using namespa

2013-03-01 21:01:24 348

原创 hdu 1254

http://acm.hdu.edu.cn/showproblem.php?pid=1254 BFS+hash,广搜路线,每次小人走都要哈希一下箱子的位置,这样保证走的时候状态是不一样的,然后要注意,这里要用优先队列,时间短的要先弹出来,这个地方值得琢磨,WA了n次!#include #include #include #include #include using nam

2013-01-29 17:55:01 302

原创 hdoj 1496 Equations

http://acm.hdu.edu.cn/showproblem.php?pid=1496 hash的简单运用,等式a*a1+b*x2+c*x3+d*x4=0,可以化作:a*a1+b*x2+c*x3+d*x4+1000000=1000000,后面的就简单了,a*a1+b*x2+1000000=1000000-c*x3+d*x4;hash起来就容易些: #include #inc

2013-01-28 20:53:16 436

原创 poj 1659 Frogs' Neighborhood

#include #include #include #include using namespace std;#define N 20struct node{ int degree; int index;}v[N];int map[N][N];int n;bool cmp(node a,node b){ return a.degree>b.

2013-01-27 11:47:54 226

原创 hdu 4422The Little Girl who Picks Mushrooms

Problem DescriptionIt's yet another festival season in Gensokyo. Little girl Alice planned to pick mushrooms in five mountains. She brought five bags with her and used different bags to collect mush

2012-11-02 20:42:08 548

原创 hdu 4430 Yukari's Birthday

Problem DescriptionToday is Yukari's n-th birthday. Ran and Chen hold a celebration party for her. Now comes the most important part, birthday cake! But it's a big challenge for them to place n cand

2012-11-02 17:25:53 937 1

原创 POJ2528 Mayor's posters

DescriptionThe 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

2012-10-26 17:52:03 528

原创 poj 3468 A Simple Problem with Integers

DescriptionYou 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

2012-10-07 11:29:10 159

原创 poj 2828 Buy Tickets

很简单的线段树,主要是弄清与原理,每个点保存的是这一段区间还有多少个空位置,把这个想明白了,所有的就都简单了!DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lu

2012-10-05 14:17:56 272

原创 hdu 1540 Tunnel Warfare

Tunnel WarfareTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2393    Accepted Submission(s): 883Problem DescriptionDuring the War o

2012-08-15 19:50:08 185

原创 hdu 1754 I Hate It

I Hate ItProblem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整

2012-08-15 11:44:23 147

原创 hdu 1166 敌兵布阵

敌兵布阵 Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些

2012-08-13 21:18:21 174

原创 Yuna's confusion

Problem DescriptionAfter yuna studies the STL container,she finds the STL powerful for AC.For the k-th number, she is also very familiar with it. Now yuna meets a very similar problem, yuna wants to

2012-08-13 09:20:06 508

原创 Merlininice’s Hometask

Merlininice’s HometaskProblem DescriptionMerlininice dosen’t love math lessons, so he always ditches math class. But as the final exam is coming, now Merlininice is really regret his actions and w

2012-08-13 09:14:21 506

原创 为什么我要注册一个博客?

从大一下学期的时候开始搞ACM,差不多一年半了,今天突然觉得,作为一个ACMer没有一个属于自己的博客,实在是不幸的,为什么这么说呢?没有及时的把自己的思路记录下来!成功还是失败,进取还是退步,一切好像过去了,就过去了!我不是一个好ACMer!........所以,我要开始写博客!

2012-08-12 19:18:48 289 1

hdu 汉诺塔

ACM HDU 汉诺塔 递归练习

2012-04-14

hdu排序练习

hdu ACM 各种排序

2012-04-14

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除