摘要:
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;const int maxn =205;struct Point{ int x, y;}slope[maxn * maxn], point[maxn];int n, tot;bool operator == (const Point &a, const Point &b){ 阅读全文
posted @ 2012-07-02 15:14
undefined2024
阅读(223)
评论(0)
推荐(0)
摘要:
dp,最长公共子序列变形View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;const int maxn = 105, maxl = 45;int text1[maxn], text2[maxn], len1, len2;char dic[maxn * 2][maxl];int tot;char first[maxl];int f[maxn][maxn], from[maxn][maxn];int 阅读全文
posted @ 2012-07-02 13:47
undefined2024
阅读(220)
评论(0)
推荐(0)
摘要:
迭代加深搜索题意:一个有向图,每条边长度为1,问要让起点到终点距离大于K,至少要删除几个点。思路:深搜,深搜过程中每次先宽搜求最短路,若最短路大于K,则已达到条件。否则最短路上必然要有点被删掉,就依次枚举删除每个点的情况并向下深搜。用迭代加深来提速,每次限定dfs搜索的深度。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;const int maxn = 60, maxm = 4005, in 阅读全文
posted @ 2012-07-02 13:20
undefined2024
阅读(214)
评论(0)
推荐(0)