随笔分类 - 深搜和广搜
摘要:https://cn.vjudge.net/problem/UVALive-6455 题目大意:题目上给出一个地图,其中@是人在地图上的出发点,#是墙,‘ . '是路。然后给出几个点,这些点表示财宝的所在地。问人是否能够得到所有的宝藏,如果能够的话给出所有的宝藏的最短的路径。 解题思路:由于只有最多
阅读全文
摘要:Terrorists are around everywhere, they always make troubles by detonating bombs. The terrorist have some gunpowder to make bombs, different gunpowder
阅读全文
摘要:Vitaly works at the warehouse. The warehouse can be represented as a grid of n × mcells, each of which either is free or is occupied by a container. F
阅读全文
摘要:Description The cows have revised their game of leapcow. They now play in the middle of a huge pasture upon which they have marked a grid that bears a
阅读全文
摘要:https://vjudge.net/contest/160830#problem/B 题意:给你n个参赛团队,m个问题,每个问题要r分钟,比赛的总时间是t,总的团队数量k。输出要解决的问题数量以及花费的总时间,然后输出解决问题的人和解决的问题号以及解决问题的开始时间。 1 #include <io
阅读全文
摘要:There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he c
阅读全文
摘要:Description In mathematics, the four color theorem, or the four color map theorem, states that, given any separation of a plane into contiguous region
阅读全文
摘要:Description Three Kingdoms is a funny game. Often Liu Bei is weak and has to run away,so in the game Liu Bei has a skill called "Dunzou". This time yo
阅读全文
摘要:Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this
阅读全文
摘要:题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1010 我认为的剪枝就是在本来的代码中加入一些附加条件使之不去进行多余的计算,防止超时 奇偶剪枝的知识链接 AC代码: 1 #include <iostream> 2 #include <cstdio>
阅读全文
摘要:题目链接: http://lightoj.com/volume_showproblem.php?problem=1337 这个题最重要的就是记忆化搜索,根据这个题我所知道的记忆化搜索就是:当出现某一测试数据时把与其有关的数据都搜索出来,以备后用。 AC代码: 1 #include <iostream
阅读全文
摘要:题目链接: http://poj.org/problem?id=2488 注意两点: 1.本题要求按照字典序最小输出所以a[8]={-1, 1, -2, 2, -2, 2, -1, 1},b[8]={-2, -2, -1, -1, 1, 1, 2, 2} 2.由于 1 <= p * q <= 26所
阅读全文
摘要:题目链接: http://lightoj.com/volume_showproblem.php?problem=1066 题目很容易,广搜和深搜应该都行,我个人认为要注意的是‘A’-->‘ . ’ AC代码: 1 #include <iostream> 2 #include<cstdio> 3 #i
阅读全文
摘要:第一个深搜的问题,虽然很简单,但是很高兴,加油!!! 题目链接: http://poj.org/problem?id=2386 题目交了好几次,一直RE,又重新写了一遍总算是A了 最初RE是由于是s[x][y]='#'放到了dfs的后面,以后要把最初的改变放在前面 RE代码,引以为戒: 1 #inc
阅读全文

浙公网安备 33010602011771号