上一页 1 ··· 74 75 76 77 78 79 80 81 82 ··· 182 下一页
摘要: 无向图的最小割,模板题用stoer_wagner算法每次从0点开始,进行一种类似于最大生成树的操作,唯一与最大生成树的区别就是在选择把哪个点加进来的时候,不是根据连到它的边的长度,而是根据它到树的所有边的长度和。然后记录最后两个进树的点合并(缩点),并用这两点间的割来更新最小值。然后不断重复此操作(生成树、缩点、最小值),直到所有点都缩为1点。正确性还没太想明白。View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using names 阅读全文
posted @ 2011-09-14 10:01 undefined2024 阅读(540) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxl 1005int p, w;char st[maxl];int f[30] ={ 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9 };int g[30] ={ 1, 2, 3, 1, 2, 3, 1, 2, 3, 阅读全文
posted @ 2011-09-13 21:20 undefined2024 阅读(105) 评论(0) 推荐(0)
摘要: 树状数组+二分View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 50005int n, m;char st[5];int ar[maxn];bool vis[maxn];int stk[maxn];int top;int lowb(int t){ return t &(-t);}void add(int i, int v){ for (; i < maxn 阅读全文
posted @ 2011-09-13 19:05 undefined2024 阅读(348) 评论(0) 推荐(0)
摘要: 简单分型题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 15int n;int power[maxn];bool is(int a, int p){ while (p >= 0) { if (a / power[p] == 1) return false; a %= power[p]; p--; } return true;}... 阅读全文
posted @ 2011-09-13 17:31 undefined2024 阅读(146) 评论(0) 推荐(0)
摘要: 简单二进制高精度,java做View Code import java.io.*;import java.util.*;import java.math.*;public class Main { static public void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in)); int t = cin.nextInt(); for (int i = 0; i < t; i++) { ... 阅读全文
posted @ 2011-09-13 16:10 undefined2024 阅读(119) 评论(0) 推荐(0)
上一页 1 ··· 74 75 76 77 78 79 80 81 82 ··· 182 下一页