2014年9月2日

数组分割

摘要: 编程之美上的题目,是一道dp的题目,设dp[i][v]表示是否可以找到i个数,使得他们的和为v,是的话,dp[i][v]=1,否则为0。状态转移方程:dp[i][v]=dp[i-1][v-arr[k]] if(v>=arr[k]&&dp[i-1][v-arr[k]]=1),边界条件是dp[0][... 阅读全文

posted @ 2014-09-02 20:59 theCambrian.cpp 阅读(246) 评论(0) 推荐(0) 编辑

LRU Cache

摘要: hash+双向链表#include #include #include #include using namespace std;class LRUCache{public: LRUCache(int capacity) { m_capacity = capacity ;... 阅读全文

posted @ 2014-09-02 10:50 theCambrian.cpp 阅读(167) 评论(0) 推荐(0) 编辑

导航