上一页 1 2 3 4 5 6 7 8 ··· 48 下一页
  2013年7月31日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4627分类讨论一下就可以代码:#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef pairppd;const double PI = acos(-1.);const double eps = (1e-9);const int N=2005;const int M=2000000;const int K=27;int main(){ //freope... 阅读全文
posted @ 2013-07-31 15:40 夜-> 阅读(175) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4622用字典树把每一个字符串对应成一个整数 相同的字符串对应到相同的整数上把所用的串对应的整数放在一个数组里 比如书字符串s[l...r]对应的整数是 k那么二维数组 [l][r] 就等于k假设一个对应好的二维数组 左下角是原点3 4 5 22 3 4 01 6 0 02 0 0 0这样求解 从l到r的不同字符串的个数 其实就是求 从[l][r] 到右下角所在的矩阵所包含不同整数的个数(不包括0)这里需要一定的去重处理 处理后是-1 0 11011 01 1 0 01 0 0 0然后一边dp就可以求... 阅读全文
posted @ 2013-07-31 15:38 夜-> 阅读(262) 评论(0) 推荐(0)
  2013年7月29日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4617三维几何简单题 多谢高尚博学长留下的模板代码:#include #include #include #include #include using namespace std;typedef long long ll;typedef pairppd;const double PI = acos(-1.);const int MAXL = (1 << 18)+100;const double eps = (1e-9);const int N=50;struct point3{double x, 阅读全文
posted @ 2013-07-29 11:54 夜-> 阅读(162) 评论(0) 推荐(0)
  2013年7月28日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4609FFT 不会 找了个模板代码:#include #include #include #include #include using namespace std;typedef long long ll;typedef pairppd;const double PI = acos(-1.);const int MAXL = (1 >2)>=n) ln=ln>>1; id = 0; fill0(1,0,a,A); fft(1.0,A); id = 0; fill0(1,0,b,... 阅读全文
posted @ 2013-07-28 17:53 夜-> 阅读(209) 评论(0) 推荐(0)
  2013年7月26日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4616要记录各种状态的段 a[2][4]a[0][j]表示以trap为起点一共有j个trap的最优值a[1][j]表示不以trap为起点一共有j个trap的最优值dp[x][i][j] 表示以x为根节点的子树从各个叶子到x节点的各状态最优值每到一个节点 要枚举经过此节点的所有符合要求的段中最优的(需要合并段)代码:#include#include#include#include#include#include#include#include#include#include#include#include#in 阅读全文
posted @ 2013-07-26 16:43 夜-> 阅读(214) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4611从A中向B中移动和从B中向A中移动的效果是一样的,我们假设从B中向A中移动 而且A>B我们先求出所有在B[0]上的点移动到A上的分布情况 可以求出花费当我们要求B[1]上的点移动到A上的分布情况时 相当于B[0]在A上的分布情况水平右移一个单位由于B[1]点对于B[0]也向后移动了一个单位 所有相对位置没有移动但是A中有一个地方需要改动 那就是每次A中最后一个位置的点需要移动到A[0]位置(因为对A进行取模的原因)还有一个要注意的情况就是 B 在向后移动的时候 点的个数可能会减小 要特殊处理一下代 阅读全文
posted @ 2013-07-26 11:24 夜-> 阅读(223) 评论(0) 推荐(0)
  2013年7月25日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4618直接DP+记忆化虽然时间复杂度看起来是300^4 但实际执行起来要远远小于这个值 所有可以水过代码:#include#include#include#include#include#include#include#include#include#include#include#include#include#include//#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;typed 阅读全文
posted @ 2013-07-25 21:43 夜-> 阅读(178) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4612将原图进行缩点 变成一个树树上每条边都是一个桥 然后加一条边要加在树的直径两端才最优代码:#include#include#include#include#include#include#include#include#include#include#include#include#include#include#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;typedef long 阅读全文
posted @ 2013-07-25 21:27 夜-> 阅读(253) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4619根据题意可知,每一个方格可能只被一个骨牌覆盖 可能被两个骨牌覆盖 也可能不被覆盖有一个骨牌覆盖的方格(单覆盖方格)为我们刚开始要找的方格遍历 每当找到一个单覆盖方格 我们就将这个方格上的骨牌保留保留这个骨牌的话 有可能会排斥另一个骨牌 如果有排斥的骨牌的话 就将排斥的骨牌去掉去掉排斥的骨牌 可能产生新的单覆盖方格,则递归下去最后把所有单覆盖方格处理完 剩下的可能全是双覆盖方格,如果有的话,剩下的骨牌通过覆盖肯定形成了环这些双覆盖方格每个都会最终保留半个骨牌代码:#include#include#incl 阅读全文
posted @ 2013-07-25 21:23 夜-> 阅读(152) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4614直接线段树维护代码:#include#include#include#include#include#include#include#include#include#include#include#include#include#include//#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;typedef long long ll;typedef unsigned int uin 阅读全文
posted @ 2013-07-25 21:03 夜-> 阅读(189) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 48 下一页