- 博客(613)
- 资源 (17)
- 收藏
- 关注
原创 poj 2886 Who Gets the Most Candies?(线段树-单点更新)
DescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero integer on it in his/her hand. The
2015-08-13 16:37:27 496
原创 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 Lunar New Year was approaching, but unluckily the Little Ca
2015-08-12 21:33:29 444
原创 hdu 3085 Nightmare Ⅱ(双向bfs)
Problem DescriptionLast night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts in the maz
2015-08-12 17:05:43 933 2
原创 hdu 1195 Open the Lock(基础bfs)
Problem DescriptionNow an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from 1 to 9. Each time, you can add or minus 1 to any
2015-08-12 11:04:55 409
原创 hdu 3309 Roll The Cube(bfs)
Problem DescriptionThis is a simple game.The goal of the game is to roll two balls to two holes each.'B' -- ball'H' -- hole'.' -- land'*' -- wallRemember when a ball rolls into a hole, t
2015-08-11 23:46:12 611
原创 hdu 2203 亲和串(kmp)
Problem Description人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现,现在长大了却不知道怎么去判断亲和串了,于是他只好又再一次来请教聪明且乐于助人的你来解决这个问题。亲和串的定义是这样的:给定两个字符串s1和s2,如果能通过s1循环移位,使s2包含在s1中,
2015-08-11 17:38:06 555
原创 hdu 1277 全文检索(ac自动机模板)
Problem Description我们大家经常用google检索信息,但是检索信息的程序是很困难编写的;现在请你编写一个简单的全文检索程序。问题的描述是这样的:给定一个信息流文件,信息完全有数字组成,数字个数不超过60000个,但也不少于60个;再给定一个关键字集合,其中关键字个数不超过10000个,每个关键字的信息数字不超过60个,但也不少于5个;两个不同的关键字的前4个数字是不
2015-08-11 14:22:17 609
原创 hdu 1358 Period(kmp)
Problem DescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string.
2015-08-11 10:51:39 404
原创 hdu 3746 Cyclic Nacklace(kmp)
Problem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed an
2015-08-10 20:04:11 424
原创 hdu 4101 Ali and Baba(bfs,dfs)
Problem DescriptionThere is a rectangle area (with N rows and M columns) in front of Ali and Baba, each grid might be one of the following:1. Empty area, represented by an integer 0.2. A Stone
2015-08-10 16:16:15 532
原创 hdu 3336 Count the string(kmp应用)
Problem DescriptionIt is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string.
2015-08-06 19:16:11 944
原创 hdu 1686 Oulipo(kmp)
Problem DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait
2015-08-06 14:55:26 392
原创 hdu 1711 Number Sequence(kmp模板题)
Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] =
2015-08-06 10:40:11 408
原创 hdu 2087 剪花布条(kmp模板)
Problem Description一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过
2015-08-06 10:10:01 643
原创 hdu 1664 Different Digits(bfs+余数判重)
Problem DescriptionGiven a positive integer n, your task is to find a positive integer m, which is a multiple of n, and that m contains the least number of different digits when represented in dec
2015-08-05 23:06:05 644
原创 hdu 2102 A计划(bfs)
Problem Description可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主
2015-08-05 13:44:33 562
原创 hdu1226 超级密码(bfs+余数判重)
Problem DescriptionIgnatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密码锁起来了,在门旁边的墙上有一些关于密码的提示信息:密码是一个C进制的数,并且只能由给定的M个数字构成,同时密码是一个给定十进制整数N(0注意:由于宝藏的历史久远,当时的系统最多只能保存500位密码.因此如果得到的密码长度大于500也不能用来开启房门
2015-08-05 10:39:52 586
原创 hdu 1429 胜利大逃亡(续)(状态压缩+bfs)
Problem DescriptionIgnatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)……这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁的门,钥匙藏在地牢另外的某些地方。刚开始Ignatius被关在(sx,sy)的位置,离开地牢的门在(ex,ey)的位置。Ignatius每分钟只能从一个坐标走到相邻四个坐标中的其中一个。
2015-08-04 14:36:27 694
原创 hdu 1885 Key Task(状态压缩+bfs)
Problem DescriptionThe Czech Technical University is rather old — you already know that it celebrates 300 years of its existence in 2007. Some of the university buildings are old as well. And the
2015-08-04 13:03:36 415
原创 hdu 2795 Billboard(线段树-单点更新)
Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcement
2015-08-04 09:52:22 436
原创 hdu 1394 Minimum Inversion Number(线段树-单点更新)
Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, ..., an, if we mov
2015-08-03 13:59:19 411
原创 hdu 1166 敌兵布阵(线段树入门-单点更新)
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视
2015-08-03 10:46:20 428
原创 hdu 1754 I Hate It(线段树入门-单点更新)
Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N
2015-08-02 22:52:31 502
原创 poj 2631 Roads in the North(裸树的直径)
DescriptionBuilding and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such that there is only one route from a village to a
2015-08-01 22:02:08 660
原创 hdu 1176免费馅饼(二维dp)
Problem Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中
2015-08-01 21:56:52 425
原创 zoj 3430 Detect the Virus(ac自动机)
Detect the VirusTime Limit:2 Seconds Memory Limit:65536 KBOne day, Nobita found that his computer is extremely slow. After several hours' work, he finally found that it was a virus...
2015-08-01 10:40:12 717 1
原创 hdu 3065 病毒侵袭持续中(ac自动机)
Problem Description小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打没有准备的战争。知己知彼,百战不殆,小t首先要做的是知道这个病毒网站特征:
2015-07-31 09:39:10 539
原创 hdu 2896 病毒侵袭(ac自动机)
Problem Description当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一。小t如此生气,他决定要把世界上所有带病毒的网站都找出来。当然,谁都知道这是
2015-07-29 23:20:42 546
原创 AC自动机算法
写在最前面的话参考并转载了部分飘过的小牛的博文,感觉挺好的,图文并茂,推荐学习的同学参考。AC自动机简介: 首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有字典树T
2015-07-29 15:10:21 705
原创 hiho一下 KMP 算法
时间限制:1000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一只河蟹,于是河蟹就向小Hi和小Ho提出了那个经典的问题:“小Hi和小Ho,你们能不能够判断一段文字(原串)里面是不是存在那么一些……特殊……的文字
2015-07-28 23:15:46 528
原创 hdu 1247 Hat’s Words(Trie树入门)
Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.You are to find all the hat’s words in a dictionary.
2015-07-28 14:06:55 491
原创 hdu 1075 What Are You Talking About(Trie树)
Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it lea
2015-07-27 22:51:15 639
原创 hdu 1671 Phone List(Trie树)
Problem DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers:1. Emerge
2015-07-27 18:23:18 505
原创 hiho一下 Trie树
时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一本词典,于是小Hi就向小Ho提出了那个经典的问题:“小Ho,你能不能对于每一个我给出的字符串,都在这个词典里面找到以这个字符串开头的所有单词呢?
2015-07-27 17:17:12 531
原创 LeetCode 61 Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.找到需要改变指针的结点,连成环,再改尾指针就行了。
2015-07-27 14:31:24 456
原创 LeetCode 24 Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y
2015-07-27 11:32:37 432
原创 LeetCode 203 Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5链表还是喜欢用递归来处理/
2015-07-26 23:18:43 393
原创 LeetCode 226 Isomorphic Strings
Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with anot
2015-07-26 23:09:16 399
原创 LeetCode 226 Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this original tweet by Max Howe
2015-07-19 14:09:13 410
TCP-IP详解卷1:协议
2015-10-15
nasm中文手册
2015-03-12
STL源码剖析简体中文完整版清晰
2014-11-11
C++标准程序库
2014-11-10
ACM培训-动态规划
2014-11-10
取石子游戏_博弈
2014-11-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人