
BFS|| DFS 搜索
文章平均质量分 63
ukiy
这个作者很懒,什么都没留下…
展开
-
POJ-1426 Find The Multiple ( BFS )
http://poj.org/problem?id=1426 Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28996 Accepted: 12023 Special Judge DescriptionGiven a positive integer n原创 2017-01-21 23:32:22 · 385 阅读 · 0 评论 -
POJ3009 Curling 2.0(dfs+剪枝)
http://poj.org/problem?id=3009 Curling 2.0 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 19525 Accepted: 7971 DescriptionOn Planet MM-21, after their Olympic games this yea原创 2017-01-19 02:37:16 · 638 阅读 · 0 评论 -
POJ1111 Image Perimeters(dfs)
Image Perimeters Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 8934 Accepted: 5325 DescriptionTechnicians in a pathology lab analyze digitized images of slides. Objects on a sl原创 2017-01-18 16:54:39 · 413 阅读 · 0 评论 -
poj1321 棋盘问题 (dfs)
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n 当为-原创 2017-01-06 23:19:08 · 366 阅读 · 0 评论 -
百练 4116 拯救行动(bfs)
描述公主被恶人抓走,被关押在牢房的某个地方。牢房用N*M (N, M <= 200)的矩阵来表示。矩阵中的每项可以代表道路(@)、墙壁(#)、和守卫(x)。英勇的骑士(r)决定孤身一人去拯救公主(a)。我们假设拯救成功的表示是“骑士到达了公主所在的位置”。由于在通往公主所在位置的道路中可能遇到守卫,骑士一旦遇到守卫,必须杀死守卫才能继续前进。现假设骑士可以向上、下、左、右四个方向移动,每移动一个原创 2016-12-04 02:01:11 · 1365 阅读 · 0 评论 -
hdu 1253 胜利大逃亡(dfs+剪枝)
Problem Description Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一原创 2016-12-03 18:42:18 · 490 阅读 · 0 评论 -
poj 3278 Catch That Cow
DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤原创 2016-12-03 19:49:22 · 360 阅读 · 0 评论 -
poj 3984 迷宫问题
Description 定义一个二维数组:int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。Input 一个5 × 5的二维数组,表示一个迷原创 2016-12-03 22:15:39 · 379 阅读 · 0 评论 -
hdu1242 Rescue (dfs+剪枝)
Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison.Angel’s原创 2016-12-03 10:49:09 · 396 阅读 · 0 评论 -
hdu 1072 Nightmare dfs+剪枝
Problem Description Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb ex原创 2016-12-03 10:39:43 · 339 阅读 · 0 评论 -
hdu1312 Red and Black
Problem Description 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 can move to one of four adjacen原创 2016-12-02 14:20:52 · 429 阅读 · 0 评论 -
hdu 1241 Oil Deposits
Problem Description The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a原创 2016-12-01 10:44:11 · 847 阅读 · 0 评论 -
hdu1010 Tempter of the Bone(dfs+剪枝)
Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He rea原创 2016-12-01 08:47:02 · 413 阅读 · 0 评论 -
hdu1016 Prime Ring Problem
Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note原创 2016-11-30 18:17:01 · 402 阅读 · 0 评论 -
马踏棋盘(递归)
估计下次上机要交… QAQ #include<iostream>#include<cstdio>#define N 8using namespace std;int board[N][N];int cnt=1;int solve(int i,int j){ //1 if((i-2>=0)&&(i-2<=7)&&(j+1>=0)&&(j+1<=7)){原创 2016-10-01 02:38:04 · 770 阅读 · 0 评论 -
ACdream-1726-A Math game(dfs+二分)
链接http://vjudge.net/problem/ACdream-1726 官方题解http://acdream.info/topic?tid=4246#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int n,h,n1,n2,a[50],b[50],c[1050000],cnt;bool原创 2016-10-10 22:37:50 · 345 阅读 · 0 评论 -
部分和问题(简单dfs)
部分和问题时间限制:1000 ms | 内存限制:65535 KB 难度:2描述 给定整数a1、a2、…….an,判断是否可以从中选出若干数,使它们的和恰好为K。输入 首先,n和k,n表示数的个数,k表示数的和。 接着一行n个数。 (1<=n<=20,保证不超int范围) 输出如果和恰好可以为k,输出“YES”,并按输入顺序依次输出是由哪几个数的和组成,否则“NO”样例输入原创 2016-10-10 22:34:21 · 529 阅读 · 0 评论 -
POJ-3126 Prime Path(BFS 求最小步数)
DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a m原创 2017-01-22 04:31:31 · 420 阅读 · 0 评论