原创 HDU 1686 Oulipo (KMP查找可交叉區間模式串)

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a mem

原创 HDU 1358 Peroid(KMP和循環節)

For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusi

原创 UVA 796 Critical Links(Tarjan求無向圖中的橋)

橋:割邊,即去掉之後原本連通的分支不再連通 求法:和割點差不多 只要 dfn[i]小於low[j],則ij就是割邊 注意這題的輸出格式,格式錯誤導致的wa了好幾次,gg…..輸出格式只要複製就可以了啊……. 還要按第一個輸

原创 HDU 3746 Cyclic Nacklace (KMP和循環節)

CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any su

原创 UVA 315 Network(Tarjan求無向圖割點)

割點:刪除該點和相關邊,原來的連通圖能變得不連通的點 求法: 當節點i是根(搜索起點)時,只要它的孩子多於兩個,那麼它就是割點,不用考慮形成環的情況,因爲在遍歷另一個形成環的點的孩子時,就已經從第一個形成環的孩子遍歷到了它 當

原创 HDU 3336 Count the strings(KMP+DP)

It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s

原创 文章標題

Dining Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 19461 Accepted: 8670 Description C

原创 HDU 1698 Just A Hook(線段樹修改區間到某值)

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up

原创 HDU 1269 迷宮城堡(Tarjan or Kosaraju模板)

迷宮城堡 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1791

原创 HDU 2087 剪花布條(KMP查找不交叉區間的模式串個數)

一塊花布條,裏面有些圖案,另有一塊直接可用的小飾條,裏面也有一些圖案。對於給定的花布條和小飾條,計算一下能從花布條中儘可能剪出幾塊小飾條來呢? Input 輸入中含有一些數據,分別是成對出現的花布條和小飾條,其布條都是用可見

原创 Watto and Mechanism(字符串hash算法)

Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a

原创 Frogs(容斥+數論)

There are mm stones lying on a circle, and nn frogs are jumping over them. The stones are numbered from 00 to m−1

原创 (線段樹+dfs序)

百度科技園內有nn個零食機,零食機之間通過n−1n−1條路相互連通。每個零食機都有一個值vv,表示爲小度熊提供零食的價值。 由於零食被頻繁的消耗和補充,零食機的價值vv會時常發生變化。小度熊只能從編號爲0的零食機出發,並且每個零

原创 HDU 1711 Number Sequence (KMP模板)

Given two sequences of numbers : a[1], a[2], …… , a[N], and b[1], b[2], …… , b[M] (1 <= M <= 10000, 1 <= N <= 10000

原创 HDU 5536(01字典樹)

John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of pr