2009年7月26日

hdu 2962 dijkstra+二分

摘要: #include <iostream>using namespace std;const int MAXN = 1010;struct MAP{int height, dist;}map[MAXN][MAXN];int hash[MAXN], dis[MAXN];int low, high, mid;int result, qq;void dijkstra(int start, int... 阅读全文

posted @ 2009-07-26 16:01 ZAFU_VA 阅读(252) 评论(0) 推荐(0)

2009年7月24日

pku 2411 dp + 状态压缩

摘要: #include <iostream>using namespace std;//1:竖放,影响下层//0:横放 或 被上层竖放的占__int64 dp[12][2050];int h,w,i,j,stateNum;void dfs(int pos, int state) //pos是每层从右往左数的位置{ if(pos == w+1) {//已到一层末位 则该层的state要加上 上... 阅读全文

posted @ 2009-07-24 16:06 ZAFU_VA 阅读(704) 评论(2) 推荐(0)

2009年7月23日

pku 1837 01背包

摘要: #include <iostream>using namespace std;const int MAXN = 15*25*20;int w[21], v[21];int dp[21][MAXN*2+1];int main(){int C, G;while (scanf("%d %d", &C, &G) != EOF){int i, j, k;memset(dp, 0,... 阅读全文

posted @ 2009-07-23 19:02 ZAFU_VA 阅读(278) 评论(0) 推荐(0)

pku 1836 2*LIS[O(nlogn)]

摘要: #include <iostream>using namespace std;class MAXLINE{public:void init(int);void DP();int LIS(int, int, bool);private:double L[1010];int len;};void MAXLINE::init(int n){len = n;int i;for (i = 0; ... 阅读全文

posted @ 2009-07-23 16:01 ZAFU_VA 阅读(418) 评论(0) 推荐(1)

2009年7月22日

pku 1745 dp 滚动数组

摘要: #include <iostream>using namespace std;const int INF = 200;unsigned char dp[110][2];int sq[10010];int main(){int N, K;while (scanf("%d %d", &N, &K) != EOF){int i, j;for (i = 0; i < N;... 阅读全文

posted @ 2009-07-22 20:33 ZAFU_VA 阅读(340) 评论(0) 推荐(1)

2009年7月20日

pku 1170 Shopping Offers dp+状态压缩

摘要: //挺好的题目 蛮经典的#include <iostream>using namespace std;const int MAXN = 6*6*6*6*6;int dp[MAXN];int product[5][3];int hash[1000];int offer_price[105];int offer[105][5];int getNum(int a[5]){int num = ... 阅读全文

posted @ 2009-07-20 22:01 ZAFU_VA 阅读(341) 评论(0) 推荐(0)

2009年5月27日

pku 1036 dp

摘要: #include <iostream>#include <algorithm>using namespace std;class Gangters{public: int T, P, S; friend bool operator<(const Gangters &a, const Gangters &b) { return a.T < b.T;... 阅读全文

posted @ 2009-05-27 08:33 ZAFU_VA 阅读(218) 评论(0) 推荐(0)

2009年5月16日

pku 1475 推箱子

摘要: #include <iostream>#include <queue>#include <string>using namespace std;const int MAXSIZE = 21;int dir[4][2] = {{-1, 0},{1, 0},{0, -1},{0, 1}};}};//将这里改了下就ac了... 显然是有多种情况的sj的吧= =char... 阅读全文

posted @ 2009-05-16 20:52 ZAFU_VA 阅读(320) 评论(0) 推荐(0)

2009年5月10日

pku 1069 百慕大三角

摘要: //g++ re c++ ac memset TLE #include <iostream>#include <vector>#include <algorithm>#include <cstdio>using namespace std;const int MAX_SIZE = 25;class Bermuda{public: void input... 阅读全文

posted @ 2009-05-10 16:46 ZAFU_VA 阅读(339) 评论(0) 推荐(0)

2009年5月9日

pku 1054 二分

摘要: #include <iostream>#include <algorithm>using namespace std;int n, m, t;class Point{public: int x, y; bool operator<(const Point &b) { if (x == b.x) { return y < b.y; } else { ret... 阅读全文

posted @ 2009-05-09 13:42 ZAFU_VA 阅读(230) 评论(0) 推荐(0)

导航