原创 poj 2481 Cows[求逆序數]

COWs Description Farmer John's cows have discovered that the clover growin

原创 bzoj3208 花神的秒題計劃Ⅰ 【記憶化】

Description 背景【backboard】:  Memphis等一羣蒟蒻出題中,花神湊過來秒題…… 描述【discribe】:  花花山峯巒起伏,峯頂常年被雪,Memphis打算幫花花山風景區的人員開發一個滑雪項目。  我們可以

原创 hdu 4418 Time travel [gause+dp]

Time travel Time Limit:1000MS    Memory Limit:32768KB    64bit IO Format:%I64d & %I64u Agent K is one of the greate

原创 poj 3774 Scout YYF I (矩陣優化的概率DP)

題意: n個雷,分別在a[1]...a[n] ,走一步概率爲 p ,走兩步概率爲 1-p ,一開始在 1 號位置,問安全到達終點的概率。 思路: 將整個過程劃分成階段處理: 1 ~ a[1] a[1]+1 ~ a[2] ………… a[n-

原创 ZOJ - 2107 Quoit Design [分治]

題目鏈接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=17751 題目描述:求最近點對 題目分析:分治,(nlogn); 爲什麼,第二輪按排序:http://no

原创 codeforces 520B Two Buttons[記憶化搜索]

傳送門:http://codeforces.com/contest/520/problem/B B. Two Buttons Vasya has found a strange device. On the front panel

原创 uva 674 Coin Change【揹包】

Brief Description: there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes w

原创 cf 398B. Painting The Wall【期望dp】

傳送門:http://codeforces.com/problemset/problem/398/B Description: User ainta decided to paint a wall. The wall consists

原创 uva 103/UVA 10405 [lcs]

uva103:題目給的是第i個的排位。 CODE: <span style="font-size:12px;">#include<iostream> #include<cstdio> #include<cstring> #include<

原创 hdu 1520 Anniversary party[樹形dp]

http://acm.hdu.edu.cn/showproblem.php?pid=1520 代碼: #include<iostream> #include<cstdio> #include<cstring> #include<cmat

原创 hdu 4336 Card Collector[期望]

Card Collector Time Limit:1000MS    Memory Limit:32768KB    64bit IO Format:%I64d & %I64u Description In your child

原创 BZoj 1293 生日禮物(小頂堆)

傳送門:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=27400 Anayse:小頂堆; 1 1 5     - >    1 3 5     ->    3 5

原创 HDU 2089 不要62【數位板】

Description: 不吉利的數字爲所有含有4或62的號碼。輸出n-m之間的吉利數的個數! Analyse: 數位dp的原理:如果A<B那麼,從高位到低位A一定出現某digit小於B‘s。 對於數位dp板,重點是參數的設置! CODE

原创 HYSBZ 1406 密碼箱【數學】

Description 在一次偶然的情況下,小可可得到了一個密碼箱,聽說裏面藏着一份古代流傳下來的藏寶圖,只要能破解密碼就能打開箱子,而箱子背面刻着的古代圖標,就是對密碼的提示。經過艱苦的破譯,小可可發現,這些圖標表示一個數以及這個

原创 baoj1875 HH去散步 【矩陣轉移】

Brief description : 給定一個可能重邊但沒有自環的無向圖,要求計算 A, B 兩點之間步數爲 t 的方案數。答案模 45989。 (可以經過某個點某條邊多次,但是不可以立即沿着同一條邊折返。) (.. N <= 20,