HDU 2851 Lode Runner(簡單DP),hdulode比較簡單的一道DP題,題意是給你n條路,每條路的最右邊有一個梯子,也就是說只要一條路的最右邊在另一條路上,那麼就可以從這條路去那條路。一開始沒考慮清楚狀態怎麼表示,TLE了一次。 因為路的最右邊從小到大排序,且不能向回走,所以用d[i]表示到大i點的最優解,那麼當前這個狀態只能由該點之前的某條路也就是某個狀態轉移過來,所以只要枚舉i點之前的所有路就行了,另外注意一下邊界。細節參見代碼:#include<cstdio>
【LeetCode-面試演算法經典-Java實現】【215-Kth Largest Element in an Array(數組中第K大的數)】,leetcode--java 【215-Kth Largest Element in an Array(數組中第K大的數)】【LeetCode-面試演算法經典-Java實現】【所有題目目錄索引】代碼下載【https://github.com/Wang-Jun-Chao】原題 Find the kth largest element
Cube Stacking POJ1988 【並查集的應用】,stackingpoj1988http://poj.org/problem?id=1988DescriptionFarmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single
【LeetCode-面試演算法經典-Java實現】【225-Implement Stack using Queues(用隊列實現棧操作)】,-javaqueues 【225-Implement Stack using Queues(用隊列實現棧操作)】【LeetCode-面試演算法經典-Java實現】【所有題目目錄索引】代碼下載【https://github.com/Wang-Jun-Chao】原題 Implement the following operations of a
ZOJ 3885--The Exchange of Items【最小費用最大流 && 建圖】,zoj3885--theThe Exchange of ItemsTime Limit: 2 Seconds Memory Limit: 65536 KB Bob lives in an ancient village, where transactions are done by one item exchange with