摘要: 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 雪溯 阅读(654) 评论(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 雪溯 阅读(115) 评论(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 雪溯 阅读(166) 评论(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 雪溯 阅读(142) 评论(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 雪溯 阅读(206) 评论(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 雪溯 阅读(190) 评论(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 雪溯 阅读(182) 评论(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 雪溯 阅读(168) 评论(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 雪溯 阅读(148) 评论(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 雪溯 阅读(108) 评论(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 雪溯 阅读(181) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1321注意是在'#'的地方放棋子矩阵大小不过8*8,即使是8!的时间复杂度也足以承受,可以直接dfs求解dfs时标注当前点的行和列已被访问,接着搜索行列都未被访问的新点,注意搜索完毕之后标注当前点的行和列未被访问#include #include... 阅读全文
posted @ 2015-03-14 13:42 雪溯 阅读(138) 评论(0) 推荐(0) 编辑