上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 48 下一页
  2012年8月8日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4345记忆化搜索 dp 比赛的时候没想出来呀亲此题和 置换群有那么丁点关系 但关系不大题目让我们求的是 实际是相加合为n的若干整数 他们的最小公倍数有多少种由于1不会影响最小公倍数所以小于等于n的都可以我们可以这么想在这个整数集合里 我们不让一个质数和它的幂次数同时出现这样的话集合里面的所有数都互质 这样就求种类数就容易递推了假如说 n=6 小于它的最小质数是2 对于其它可能存在的质数(只是可能)的质数 (3 , 5)首先 2 可以不存在 是一种情况然后2存在 2和其它的质数互质 所以2和集合可以组成的任意最 阅读全文
posted @ 2012-08-08 10:33 夜-> 阅读(585) 评论(0) 推荐(0) 编辑
  2012年8月7日
摘要: http://poj.org/problem?id=3255第k短路#include<iostream>#include<cstdio>#include<algorithm>#include<cmath>#include<queue>#include<string.h>using namespace std;const int N=5001;const int M=200005;const int MAX=0x5fffffff;int head[N];struct node{ int j,k; int next;}side 阅读全文
posted @ 2012-08-07 10:07 夜-> 阅读(204) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2449第k短路 刚开始上网找了分标准解法 没看懂呀 汗 然后看别人都用了A*算法 我也不知道是什么东西如果我们用队列枚举的话 当第k次出现终点 则这时就是到终点的第k短路但是这样队列是承受不住的 因为数据会太多对于这道题 思路好像基本上就是构造一个函数 f(i)=g(i)+h(i) g为出发点到i的最短距离 h为终点到i的最短距离f 为他们的和但每次取f最小的点进行更新直到终点出现第k次 既为答案#include<iostream>#include<cstdio>#include<algorithm>#i 阅读全文
posted @ 2012-08-07 09:37 夜-> 阅读(151) 评论(0) 推荐(0) 编辑
  2012年8月6日
摘要: http://poj.org/problem?id=2728分数规划+二分 此题的图过于稠密 需要用prime 找最小生成树代码:#include<iostream>#include<cstdio>#include<algorithm>#include<cmath>#include<queue>#include<string.h>using namespace std;const double eps=1e-5;const int N=1001;const double M=10000000000.0;struct nod 阅读全文
posted @ 2012-08-06 15:07 夜-> 阅读(176) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3621分数规划+二分 最优比率环 不是很难 本题中没有说明从哪个点开始 不过好像默认为1就可以过 poj数据又水了里面的用spfa判定部分还是不太懂代码及其注释:#include<iostream>#include<stdio.h>#include<algorithm>#include<math.h>#include<queue>#include<string.h>using namespace std;const double eps=1e-5;const int N 阅读全文
posted @ 2012-08-06 10:42 夜-> 阅读(179) 评论(0) 推荐(0) 编辑
  2012年8月5日
摘要: http://poj.org/problem?id=1125#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<map>#include<cstring>#include<algorithm>#define LL long longusing namespace std;const int N=105;const int MAX=100000;int dist[N][N]; 阅读全文
posted @ 2012-08-05 16:20 夜-> 阅读(126) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1874很水#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue>#include<map>#include<cstring>#include<algorithm>#define LL long longusing namespace std;const int N=205;const int MAX=0x5f 阅读全文
posted @ 2012-08-05 15:21 夜-> 阅读(128) 评论(0) 推荐(0) 编辑
  2012年8月4日
摘要: http://poj.org/problem?id=1639最小限制生成树 黑书上有 推荐 我看了上面的解析自己闷头写了一个 不好 我自己看着都乱 唉就这样吧大体就是 先求出除了关键点以外的点形成的若干最小生成树 然后把这些最小生成树和关键点用最短的距离联系起来然后不断点加与关键点之间的的连线 每联一个就会多一个环 然后就得删一个边 把环取消 不过加的边 和删的边的选取必须是加边减去删边的值最小 一旦限度达到 或者更新后不如原来的小了 则放弃更新代码:#include<iostream>#include<cstdio>#include<cstdlib>#in 阅读全文
posted @ 2012-08-04 22:03 夜-> 阅读(158) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4333对我来说这个题 太难了 看着标准程序敲的 伤不起呀解析说是和KMP有关 不过已经变形的不成样子了 如果在比赛时做出了 你真的是牛神了基本方法就是 先copy一个放在原串后面依次求 以某处为开始点比较时原串要比较到的位置 位置超出字符串长度 说明相等还要出来连续循环的情况 因为要找不同的数#include<iostream>#include<cstdio>#include<cstdlib>#include<ctime>#include<queue> 阅读全文
posted @ 2012-08-04 11:41 夜-> 阅读(250) 评论(0) 推荐(0) 编辑
  2012年8月3日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4332啊 又是一道伤不起的题呀 刚开始看了说是状态压缩 dp 然后自己就用滚动数组去写了 超时n的大小是 10^9 当然超时 唉又仔细看了一下解题 用什么矩阵快速幂乘 好吧用了一个还是超时看了标准代码没看懂呢 愁死了 最后把不同幂的矩阵打表 侥幸过了........................................................ 废话分割线 ..........................................................用0表示这个地方需要下 阅读全文
posted @ 2012-08-03 17:35 夜-> 阅读(411) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 48 下一页