上一页 1 ··· 58 59 60 61 62 63 64 65 66 ··· 182 下一页
摘要: 简单题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)
摘要: bfsView Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;struct Edge{ int v, next;}edge[50];struct Node{ int f[7]; int s;}q[1000000], node;int head[10];int ecount = 0;bool vis[1000000];int step[1000000];void addedge(int a, int b 阅读全文
posted @ 2011-10-13 18:13 undefined2024 阅读(298) 评论(0) 推荐(0)
摘要: 高精度组合数学View Code import java.io.*;import java.util.*;import java.math.*;public class Main { public static void main(String[] args) throws FileNotFoundException { Scanner cin = new Scanner(new BufferedInputStream(System.in)); //Scanner cin = new Scanner(new FileInputStream("t.txt"... 阅读全文
posted @ 2011-10-13 13:09 undefined2024 阅读(198) 评论(0) 推荐(0)
上一页 1 ··· 58 59 60 61 62 63 64 65 66 ··· 182 下一页