
dfs/bfs
文章平均质量分 53
csdn_PatrickStar
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
棋盘问题(dfs)
Problem:棋盘问题Description:在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input:输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数...原创 2018-11-16 00:10:17 · 213 阅读 · 0 评论 -
Prime Path(bfs)
Problem:Prime PathDescription:The 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 ...原创 2018-11-22 22:13:46 · 188 阅读 · 0 评论 -
Tavas and SaDDas(dfs)
Problem:Tavas and SaDDasDescription:Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn’t stop doing that. That’s why Keione told his smart fr...原创 2018-11-24 11:23:12 · 450 阅读 · 0 评论 -
Pots(bfs+dfs)
Problem:PotsDescription:You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:1.FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;...原创 2018-11-25 19:21:19 · 300 阅读 · 0 评论 -
符号三角形(dfs)
Problem:符号三角形Description:符号三角形的 第1行有n个由“+”和”-“组成的符号 ,以后每行符号比上行少1个,2个同号下面是”+“,2个异 号下面是”-“ 。计算有多少个不同的符号三角形,使其所含”+“ 和”-“ 的个数相同 。 n=7时的1个符号三角形如下:+ + - + - + + + - - - - + - + + + - - + + - - + - -...原创 2018-11-25 20:45:53 · 435 阅读 · 0 评论 -
非常可乐(bfs)
Problem:非常可乐Description:大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可...原创 2018-11-24 19:39:24 · 207 阅读 · 0 评论 -
Find a way(bfs)
Problem:Find a wayDescription:Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Mercek...原创 2018-11-24 22:46:24 · 219 阅读 · 0 评论 -
迷宫问题(bfs)
Problem:迷宫问题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表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线...原创 2018-11-25 00:54:17 · 169 阅读 · 0 评论 -
Smallest Difference(dfs+STL)
Problem:Smallest DifferenceDescription:Given a number of distinct decimal digits, you can form one integer by choosing a non-empty subset of these digits and writing them in some order. The remainin...原创 2018-11-25 12:40:31 · 290 阅读 · 0 评论 -
Find The Multiple(bfs)
Problem:Find The MultipleDescription:Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume t...原创 2018-11-22 22:08:07 · 182 阅读 · 0 评论 -
Oil Deposits(bfs)
Problem:Oil DepositsDescription:The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, ...原创 2018-11-19 23:29:54 · 141 阅读 · 0 评论 -
A strange lift(dfs)
Problem:A strange liftDescription:There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons原创 2018-11-16 01:04:00 · 137 阅读 · 0 评论 -
Red and Black(bfs)
Problem:Red and BlackDescription: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 ...原创 2018-11-18 18:46:49 · 253 阅读 · 0 评论 -
Catch That Cow(bfs)
Problem:Catch That CowDescription:Farmer 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 th...原创 2018-11-18 22:19:02 · 263 阅读 · 0 评论 -
N皇后问题(dfs)
Problem:N皇后问题Description:在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input:共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output:共有若干行,每行一个正整数,表示对应输入行...原创 2018-11-18 23:44:53 · 142 阅读 · 0 评论 -
Knight Moves(bfs)
Problem:Knight MovesDescription:A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a gi...原创 2018-11-16 11:52:01 · 350 阅读 · 0 评论 -
逃离迷宫(bfs)
Problem:逃离迷宫Description: 给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,gloria不能走到迷宫外面去。令人头痛的是,gloria是个没什么方向感的人,因此,她在行...原创 2018-11-17 00:22:38 · 426 阅读 · 0 评论 -
Fliptile(dfs+状态压缩)
Problem:FliptileDescription:Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × ...原创 2018-11-22 00:47:12 · 152 阅读 · 0 评论 -
Flip Game(bfs+状态压缩)
Problem:Flip GameDescription:Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and eac...原创 2018-11-23 20:35:09 · 529 阅读 · 0 评论 -
Dungeon Master(bfs)
Problem:Dungeon MasterDescription:You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one ...原创 2018-11-25 16:11:53 · 126 阅读 · 0 评论