原创 hdoj1159Common Subsequence(LCS 最長公共子序列)

Problem Description A subsequence of a given sequence is the given sequence with some elements (possible none) left o

原创 CodeForces 510B B. Fox And Two Dots

Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m

原创 hdoj5748 Bellovin 【BestCoder Round #84】 (最長上升序列)

Problem Description Peter has a sequence a1,a2,...,an and he define a function on the sequence -- F(a1,a2,...,an)=(f

原创 51nod最長公共子序列問題

輸入 第1行:字符串A 第2行:字符串B (A,B的長度 <= 1000) 輸出 輸出最長的子序列,如果有多個,隨意輸出1個。 輸入示例 abcicba abdkscab 輸出示例 abca 代碼如下:#

原创 hdoj2546飯卡(揹包01)

Problem Description 電子科大本部食堂的飯卡有一種很詭異的設計,即在購買之前判斷餘額。如果購買一個商品之前,卡上的剩餘金額大於或等於5元,就一定可以購買成功(即使購買後卡上餘額爲負),否則無法購買(即使金額足夠)。所

原创 hdoj3466Proud Merchants(排序+01揹包)

Problem Description Recently, iSea went to an ancient country. For such a long time, it was the most wealthy and powe

原创 hdoj2602Bone Collector(01揹包裸題)

Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man li

原创 Codeforces Round #367 (Div. 2) B - Interesting drink

Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he

原创 51nod 最大子段和

給出一個整數數組a(正負數都有),如何找出一個連續子數組(可以一個都不取,那麼結果爲0),使得其中的和最大? 例如:-2,11,-4,13,-5,-2,和最大的子段爲:11,-4,13。和爲20。 輸入 第1行:整數序列的

原创 CodeForces 659A Round House(技巧)

Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n 

原创 51nod 矩陣取數問題

給定一個m行n列的矩陣,矩陣每個元素是一個正整數,你現在在左上角(第一行第一列),你需要走到右下角(第m行,第n列),每次只能朝右或者下走到相鄰的位置,不能走出矩陣。走過的數的總和作爲你的得分,求最大的得分。 輸入 第1行:N,N

原创 Codeforces Round #367 (Div. 2)ABeru-taxi

Vasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his h

原创 hdoj 2063 過山車(二分圖匹配)

Problem Description RPG girls今天和大家一起去遊樂場玩,終於可以坐上夢寐以求的過山車了。可是,過山車的每一排只有兩個座位,而且還有條不成文的規矩,就是每個女生必須找個個男生做partner和她同坐。但是,每

原创 hdoj1711(KMP模板題)Number Sequence

Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M

原创 hdoj1203I NEED A OFFER!(01揹包變形)

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