原创 HDU 5289 Assignment [RMQ區間查詢+二分搜索]

題幹 hdu 5289走你 題解 /** *RMQ區間查詢+二分搜索 **/ #include<cstdio> #include<cmath> #include<algorithm> using namespace std; co

原创 POJ 1703 Find them, Catch them[並查集]

題幹 Description The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TW

原创 HDU 2196 Computer [樹形dp]

題幹 走你 題解 /** *比較經典的樹形dp *跑兩次深搜,都是從根1開始搜索,第一次深搜獲得最大子樹, *第二次深搜是在第一次深搜的基礎上,進行dp操作,獲得最終結果 *一個結點最終的結果,可能來自於這個結點的父親,也可能來自

原创 HDU 2062 Subset sequence[排列組合]

題幹 Problem Description Consider the aggregate An= { 1, 2, …, n }. For example, A1={1}, A3={1,2,3}. A subset sequen

原创 ACM 求素數 線性篩法 o[n]

線性篩法,終於搞明白了,附帶大神的講解,走你 const int N = 5000; int isNotPrime[N]={1,1};//0和1都不是素數,其他的取默認值0代表是素數 int prime[N];//保存素數的數組

原创 POJ 2184 Cow Exhibition [動態規劃 01揹包]

題幹 Description “Fat and docile, big and dumb, they look so stupid, they aren’t much fun…” - Cows with Guns by D

原创 深入剖析Visual Studio Code

詳情點擊:深入剖析Visual Studio Code 歡迎關注微信公衆號:micsaycom 點贊 收藏 分享 文章舉報 細水會流長 發佈了40 篇原創文章 · 獲

原创 ACM[數論公式]

同餘與模運算 (a+b)mod n = ((a mod n)+(b mod n))mod n (a-b) mod n = ((a mod n)-(b mod n) + n)mod n a*b mod n = (a mod n)(b

原创 HDU 4597 Play Game[博弈論 負值最大函數 記憶化搜索]

題幹 Problem Description Alice and Bob are playing a game. There are two piles of cards. There are N cards in each p

原创 後綴數組

鏈接 這裏是羅老師的講解,我認爲夠詳細了。 解題思路 用後綴數組解字符串子串問題,要先理清楚SA數組,Rank數組,Height數組的真正含義,再將某個問題的答案用這三個數組表達出來,有時候可能要加上自己另外構造的輔助數組,公式

原创 HDU 2639 Bone Collector II [動態規劃 第k大01揹包]

題幹 Problem Description The title of this problem is familiar,isn’t it?yeah,if you had took part in the “Rookie Cup

原创 POJ 1837 Balance [動態規劃——完全揹包]

題幹 Description Gigel has a strange “balance” and he wants to poise it. Actually, the device is different from any o

原创 HDU 1087 Super Jumping! Jumping! Jumping![動態規劃——最大遞增子序列]

之前做過最長遞增子序列,這次碰到一個最大遞增子序列,題意如下: 有一個跳跳棋棋盤,棋盤上面每個位置都有一個正數,你只能從左到右跳,每踩到一個位置,你的總分就加上該位置的數,一次可以跳一個或者多個,並且,你踩的數只能越踩越大

原创 HDU 5723 Abandoned country [最小生成樹+dfs]

題幹 Problem Description An abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandon

原创 HDU 1203 I NEED A OFFER![動態規劃——01揹包問題+簡單概率]

題幹 Problem Description Speakless很早就想出國,現在他已經考完了所有需要的考試,準備了所有要準備的材料,於是,便需要去申請學校了。要申請國外的任何大學,你都要交納一定的申請費用,這可是很驚人的。Sp