03 2015 档案

摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2181只有20个城市,而且每个点的度数恰好是3,也就意味着,对于即将进入环中的点,入度1,出度2,下一个点只有两种可能暴力枚举出所有的路径,也不过3*2^18,之后对于每个点作为起点的情况分别调整即可#includ... 阅读全文
posted @ 2015-03-27 16:02 雪溯 阅读(589) 评论(0) 推荐(1) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3533一道普通的bfs,但是由于代码实现出了bug还是拖了很久甚至对拍了需要注意的是:1.人不能经过炮台2.能量耗尽时如果进入终点且终点没有炮弹也可以3.炮台会遮挡住别的炮弹前两点认为读题时不能确定#include... 阅读全文
posted @ 2015-03-27 15:58 雪溯 阅读(278) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3567相比Eight,似乎只是把目标状态由确定的改成不确定的,但是康托展开+曼哈顿为h值的A*和IDA*都不过,而且也不好控制字典序换个角度想,虽然起始状态有很多,但是到底哪一位是1,哪一位是2不是最重要的,最重要... 阅读全文
posted @ 2015-03-19 23:04 雪溯 阅读(675) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=1011要把所给的集合分成几个集合,每个集合相加之和ans相等,且ans最小,因为这个和ans只在[1,64*50]内,所以可以用dfs一试首先ans需要满足两个条件1.可以被总集合的和sum整除 2.是总集合的某个子集的和 对于条件1,可以通过试... 阅读全文
posted @ 2015-03-19 00:57 雪溯 阅读(175) 评论(0) 推荐(0) 编辑
摘要:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3916这道题要求一种填充+挖坑+建屏障的方法,使得这块土地上的所有坑和草地之间都有屏障,挖坑... 阅读全文
posted @ 2015-03-18 22:23 雪溯 阅读(431) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=1077http://acm.hdu.edu.cn/showproblem.php?pid=1043X=a[n]*(n-1)!+a[n-1]*(n-2)!+...+a[i]*(i-1)!+...+a[1]*0! 其中,a[i]为整数,并且X=a[n... 阅读全文
posted @ 2015-03-17 12:57 雪溯 阅读(161) 评论(0) 推荐(0) 编辑
摘要:http://codeforces.com/problemset/problem/241/E首先检测哪些点会出现在从起点到终点的路上,可以用dfs或者迭代,然后,对于所有的边,设f为边起点,t为边终点,dp[i]为从起点出发到i点所必须花费的时间,则当dp[t]>dp[f]+2,也就是超出限制时,把... 阅读全文
posted @ 2015-03-16 14:50 雪溯 阅读(347) 评论(0) 推荐(0) 编辑
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1676对顶点i,j,起点s=1,终点t=n,可以认为题意要求一组01矩阵use[i][j],使得aveCost=sigma(use[i][j]*cost[i][j])/sigma(... 阅读全文
posted @ 2015-03-16 13:18 雪溯 阅读(215) 评论(0) 推荐(0) 编辑
摘要:http://acm.timus.ru/problem.aspx?space=1&num=1040题目要求在一个联通无向图中找出一种方法给边标号使得任意一个有多条边的点,边的号码的最大公约数都为1想象在dfs树上,以1为根进入,将第一条边标为序号1,则节点1满足条件剩下的边遵照dfs顺序表明,那么非... 阅读全文
posted @ 2015-03-15 02:01 雪溯 阅读(320) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5186题意是分别对每一位做b进制加法,但是不要进位模拟,注意:1 去掉前置0 2 当结果为0时输出0,而不是全部去掉#include #include #include using namespace std;co... 阅读全文
posted @ 2015-03-15 00:01 雪溯 阅读(154) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2612bfs两次就可将两个人到达所有kfc的时间求出,取两人时间之和最短的即可,这个有点不符合实情,题目应该出两人最大时间最小才对#include #include #include using namespace... 阅读全文
posted @ 2015-03-14 20:30 雪溯 阅读(156) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1495第三个杯子的盛水量可由前两个杯子得到,而前两个杯子状态总数在100*100以内,穷举可实现#include #include #include using namespace std;const int mx... 阅读全文
posted @ 2015-03-14 20:27 雪溯 阅读(657) 评论(0) 推荐(1) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1241对每个还未访问的点bfs,到达的点都标为一块,最后统计有多少块即可#include #include #include using namespace std;const int maxn=101;const... 阅读全文
posted @ 2015-03-14 20:24 雪溯 阅读(116) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=3984典型的迷宫问题,记录最快到达某个点的是哪个点即可#include #include #include using namespace std;const int maxn=10;const int inf=0x3fffffff;struct... 阅读全文
posted @ 2015-03-14 20:21 雪溯 阅读(169) 评论(0) 推荐(0) 编辑
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2671首先对火进行一次bfs,得到着火时间,然后对人进行一次bfs,只允许进入还没有着火的点注意:出迷宫条件... 阅读全文
posted @ 2015-03-14 20:18 雪溯 阅读(143) 评论(0) 推荐(0) 编辑
摘要:http://acm.fzu.edu.cn/problem.php?pid=2150注意这道题可以任选两个点作为起点,但是时间仍足以穷举两个点的所有可能#include #include #include using namespace std;const int maxn=11;const int... 阅读全文
posted @ 2015-03-14 20:13 雪溯 阅读(207) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=3414记录瓶子状态,广度优先搜索即可#include #include #include using namespace std;const int maxn=101;int n,m;typedef unsigned long long ull;... 阅读全文
posted @ 2015-03-14 20:10 雪溯 阅读(191) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=3087设:s1={A1,A2,A3,...Ac}s2={Ac+1,Ac+2,Ac+3,....A2c}则合在一起成为Ac+1,A1,Ac+2,A2......A2c,Ac经过一次转换之后变成s1={Ac+1,A1,Ac+2.....}s2={..... 阅读全文
posted @ 2015-03-14 20:07 雪溯 阅读(167) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=3126搜索的时候注意1:首位不能有02:可以暂时有没有出现在目标数中的数字#include #include #include using namespace std;const int maxn=1e4+5;const int inf=0x7f... 阅读全文
posted @ 2015-03-14 18:20 雪溯 阅读(184) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=1426测试了一番,从1-200的所有值都有long long下的解,所以可以直接用long long 存储从1出发,每次向10*s和10*s+1转移,只存储余数即可,对于余数i,肯定只有第一个余数为i的最有用,只记录这个值即可#include #... 阅读全文
posted @ 2015-03-14 18:18 雪溯 阅读(170) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=3279明显,每一位上只需要是0或者1,遍历第一行的所有取值可能,(1#include #include #include using namespace std;int maz[15][15];int op[15][15];int ans[15]... 阅读全文
posted @ 2015-03-14 13:55 雪溯 阅读(149) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=3278从n出发,向两边转移,为了不使数字无限制扩大,限制在2*k以内,注意不能限制在k以内,否则就缺少不断使用-1得到的一些结果#include #include #include #include using namespace std;con... 阅读全文
posted @ 2015-03-14 13:50 雪溯 阅读(110) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=2251bfs,把两维换成三维,但是30*30*30=9e3的空间时间复杂度仍然足以承受#include #include #include #include using namespace std;struct P{ int x,y... 阅读全文
posted @ 2015-03-14 13:45 雪溯 阅读(182) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=1321注意是在'#'的地方放棋子矩阵大小不过8*8,即使是8!的时间复杂度也足以承受,可以直接dfs求解dfs时标注当前点的行和列已被访问,接着搜索行列都未被访问的新点,注意搜索完毕之后标注当前点的行和列未被访问#include #include... 阅读全文
posted @ 2015-03-14 13:42 雪溯 阅读(140) 评论(0) 推荐(0) 编辑
摘要:http://www.spoj.com/problems/VLATTICE/明显,当gcd(x,y,z)=k,k!=1时,(x,y,z)被(x/k,y/k,z/k)遮挡,所以这道题要求的是gcd(x,y,z)==1的个数+{(x,y,0)|gcd(x,y)==1}的个数+3{(0,0,1),(0,1... 阅读全文
posted @ 2015-03-11 23:26 雪溯 阅读(197) 评论(0) 推荐(0) 编辑
摘要:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2640http://www.spoj.com/problems/SPOINTS/en/htt... 阅读全文
posted @ 2015-03-11 08:34 雪溯 阅读(286) 评论(0) 推荐(0) 编辑
摘要:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3914对L研究可以发现相当于黑-横白,黑-纵白,每个黑白都要被匹配到,其中黑的横纵各两次,很... 阅读全文
posted @ 2015-03-11 08:17 雪溯 阅读(230) 评论(0) 推荐(0) 编辑
摘要:http://www.spoj.com/problems/COMPANYS/en/题目要求恰好有k条0类边的最小生成树每次给0类边的权值加或减某个值delta,直到最小生成树上恰好有k条边为0,此时得到最小生成树的权值-更改的值*k即为答案但是直接这么做的话会超时,因为都是整数权值,所以只需要优先取... 阅读全文
posted @ 2015-03-11 01:08 雪溯 阅读(423) 评论(0) 推荐(0) 编辑
摘要:http://codeforces.com/problemset/problem/160/D这道题要求哪条边存在于某个最小生成树中,哪条边不存在于最小生成树中,哪条边绝对存在于最小生成树中明显桥边一定存在于所有最小生成树中,然而怎么处理存在某个最小生成树的边呢?借助kruskal算法的性质,由小到大... 阅读全文
posted @ 2015-03-11 00:50 雪溯 阅读(352) 评论(0) 推荐(0) 编辑
摘要:http://codeforces.com/problemset/problem/272/E把仇恨关系想象为边,因为度只能为0,1,2,3,所以有以下几种0,1 直接放即可2: 有(1,1),(0,2)两种情况,第一种随便放,第二种放0那里3:有(1,2),(0,3)两种情况,第一种放1,第二种放0... 阅读全文
posted @ 2015-03-11 00:35 雪溯 阅读(265) 评论(0) 推荐(0) 编辑
摘要:http://codeforces.com/problemset/problem/274/D这道题解题思路:对每一行统计,以小值列作为弧尾,大值列作为弧头,(-1除外,不连弧),对得到的图做拓扑排序即可.但本题数据较大,所以需要进行缩点,把相同数值的点缩在一起,成为一个新的大点,原先的小值列向大点连... 阅读全文
posted @ 2015-03-10 22:55 雪溯 阅读(350) 评论(0) 推荐(0) 编辑
摘要:1.http://docs.python.org/dev/3.0/whatsnew/3.0.htmlpython-announce-listpython-help2.交互式编译器3.非整数除法 .1.>>> from__future__import divisionSyntaxError: inva... 阅读全文
posted @ 2015-03-04 19:38 雪溯 阅读(223) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示