
搜索
文章平均质量分 82
Megumin
这个作者很懒,什么都没留下…
展开
-
OpenJudge 海贼王之伟大航路 DFS+状态压缩
描述“我是要成为海贼王的男人!”,路飞一边喊着这样的口号,一边和他的伙伴们一起踏上了伟大航路的艰险历程。路飞他们伟大航路行程的起点是罗格镇,终点是拉夫德鲁(那里藏匿着“唯一的大秘宝”——ONE PIECE)。而航程中间,则是各式各样的岛屿。因为伟大航路上的气候十分异常,所以来往任意两个岛屿之间的时间差别很大,从A岛到B岛可能需要1天,而从B岛到A岛则可能需要1年。当然,任意两个原创 2016-07-20 22:48:18 · 1185 阅读 · 0 评论 -
NYOJ499 迷宫 DFS
描述一个由 n * m 个格子组成的迷宫,起点是(1, 1), 终点是(n, m),每次可以向上下左右四个方向任意走一步,并且有些格子是不能走动,求从起点到终点经过每个格子至多一次的走法数。输入第一行一个整数 T 表示有 T 组测试数据。(T 对于每组测试数据:第一行两个整数 n, m,表示迷宫有 n * m 个格子。(1 输出对于每组测试数据,输出一个整数 R原创 2016-08-02 17:09:49 · 344 阅读 · 0 评论 -
NYOJ49 开心的小明 DFS/01背包
描述小明今天很开心,家里购置的新房就要领钥匙了,新房里有一间他自己专用的很宽敞的房间。更让他高兴的是,妈妈昨天对他说:“你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过N 元钱就行”。今天一早小明就开始做预算,但是他想买的东西太多了,肯定会超过妈妈限定的N 元。于是,他把每件物品规定了一个重要度,分为5 等:用整数1~5 表示,第5 等最重要。他还从因特网上查到了每件物品的价格(都是整原创 2016-08-02 14:26:39 · 424 阅读 · 0 评论 -
OpenJudge 迷宫问题 BFS
描述定义一个二维数组: 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表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线输入一个5 × 5的二维原创 2016-07-21 12:31:43 · 550 阅读 · 0 评论 -
POJ3278 Catch That Cow BFS入门
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原创 2016-07-21 10:56:07 · 326 阅读 · 0 评论 -
Poj1321 棋盘问题 DFS
Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n原创 2016-07-20 23:35:03 · 343 阅读 · 0 评论 -
POJ1164 The Castle DFS
Description 1 2 3 4 5 6 7 ############################# 1 # | # | # | | # #####---#####---#---#####---# 2 # # | # # # # # #---#####-原创 2016-07-19 19:26:55 · 388 阅读 · 0 评论 -
UVa11181 Probability|Given DFS+概率
N friends go to the local super market together. The probability of their buying something from the market is respectively. After their marketing is finished you are given the information that exactly原创 2016-07-12 15:36:33 · 350 阅读 · 0 评论 -
Poj1190 生日蛋糕 DFS
#include #include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x3f3f3f3ftypedef long long LL;int n,m,sum;int ans=INF;int minv原创 2016-07-22 11:59:27 · 404 阅读 · 0 评论 -
CodeFroces723D Lakes in Berland BFS
The map of Berland is a rectangle of the size n × m, which consists of cells of size 1 × 1. Each cell is either land or water. The map is surrounded by the ocean.Lakes are the maximal regions of原创 2017-04-07 23:45:22 · 387 阅读 · 0 评论