原创 Codeforces Round #244 (Div. 2)B Prison Transfer

B. Prison Transfer time limit per test 1 second memory limit per test 256 megabytes input standard input

原创 poj 1050 To the Max

To the Max Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 39768   Accepted: 21017 Description Given a

原创 樹狀數組

轉自http://hawstein.com/posts/binary-indexed-trees.html#findind 樹狀數組(Binary Indexed Trees) November 15, 2012 作者:Hawst

原创 kmp的簡單理解

參考的是:http://www.matrix67.com/blog/archives/115 kmp算法就是解決兩個字符串,目標文本T,關鍵詞字符串S,匹配的問題。 比如  T:abababcdabc     S:abc   在T裏找出連

原创 poj 1094 Sorting It All Out(拓撲排序)

Sorting It All Out Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 27572   Accepted: 9546 Description

原创 poj 2955

Brackets Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3961   Accepted: 2085 Description We give the

原创 數位dp專輯

1.題目鏈接:codeforces 55D 【題意】一個數能被它每一位的數字整除(0除外)則爲beautiful number ,問[l,r]之間有多少個這樣的數 【思路】考慮到每一位的數字只能是1,2,,9,最小公倍數爲2520 設數w

原创 hdu 1867 A + B for you again

A + B for you again Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submissi

原创 ac 自動機

/*以hdu 3065爲例 ac自動機=kmp+trie 與kmp的思想是一樣的,不過實現起來就有相當多的細節問題了。 1.建立字典樹是必須的,ch[i][j],i是節點編號,j是兒子。每一個節點都隱含有MAX_SIZE個兒子的指針,

原创 取子集

</pre><pre name="code" class="cpp">#include<cstdio> #include<cstring> #include<iostream> using namespace std; void prin

原创 hdu 2222(Keywords Search) (AC自動機)

Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s

原创 LightOJ 1422 Halloween Costumes (區間dp)

1422 - Halloween Costumes PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Gappu ha

原创 codeforces 149d Coloring Brackets

Coloring Brackets time limit per test 2 seconds memory limit per test 256 megabytes input standard

原创 poj 1330 Nearest Common Ancestors

Nearest Common Ancestors Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17879   Accepted: 9492 Descri

原创 poj 1185 炮兵陣地

題目連接:http://poj.org/problem?id=1185 【題意】只能在P上放炮兵,給出攻擊範圍,炮兵不能相互攻擊,問最多能放多少個炮兵 【思路】dp,dp[i][j][k]表示第i行的炮兵擺放狀態爲j,第i-1行狀態爲k,