
搜索_dfs
SCUT_Pein
这个作者很懒,什么都没留下…
展开
-
HDU1269--迷宫城堡--深度优先搜索
Description为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N Input输入包含多组数据,输入的第一行有两个数:N和M,接下来的M行每行有两个数a和b,表示了一条通道可以从A房间来到B房间。文件最后以两个0结束。 Output对于输入的每组数据,如果任意两个房间都是相互连接的,输出"Ye原创 2013-02-01 23:03:01 · 549 阅读 · 0 评论 -
POJ3411--Paid Roads
DescriptionA network of m roads connects N cities (numbered from 1 toN). There may be more than one road connecting one city with another. Some of the roads are paid. There are two ways to pay f原创 2013-07-21 19:43:16 · 870 阅读 · 0 评论 -
POJ1724--ROADS
DescriptionN cities named with numbers 1 ... N are connected with one-way roads. Each road has two parameters associated with it : the road length and the toll that needs to be paid for the road (ex原创 2013-07-21 20:49:27 · 1074 阅读 · 0 评论 -
POJ1753--HDU2209--深搜翻牌类游戏
Problem Description有一种纸牌游戏,很有意思,给你N张纸牌,一字排开,纸牌有正反两面,开始的纸牌可能是一种乱的状态(有些朝正,有些朝反),现在你需要整理这些纸牌。但是麻烦的是,每当你翻一张纸牌(由正翻到反,或者有反翻到正)时,他左右两张纸牌(最左边和最右边的纸牌,只会影响附近一张)也必须跟着翻动,现在给你一个乱的状态,问你能否把他们整理好,使得每张纸牌都正面朝上,如果可以,最原创 2013-03-28 11:27:17 · 1365 阅读 · 1 评论 -
HDU1864--DP+深搜
Problem Description现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。 Input测试输入包含若干测试用例。每个测试用例的第1行包含两原创 2013-04-04 23:49:16 · 923 阅读 · 0 评论 -
How Many Islands?--SOJ 2013week2.1001
DescriptionYou are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figure B-1 is an example of a map.You can walk from a square land area to ano原创 2013-03-17 16:11:03 · 1558 阅读 · 1 评论 -
POJ3009--Curling 2.0
/*开始的时候,冰壶在起点冰壶只能够沿着x y方向移动冰壶需要至少一格子的惯性才能撞破石头冰壶撞到石头的时候,石头消失,冰壶停在石头之前的位置,石头消失冰壶出界,或者超过10步还不能到达,失败冰壶到达终点,成功0代表空地1代表石头2代表起点3代表终点*/#include #include using namespace std;#defi原创 2013-03-03 20:38:25 · 548 阅读 · 0 评论 -
POJ1321--棋盘问题
Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 当为-原创 2013-02-27 16:02:44 · 436 阅读 · 0 评论 -
POJ2488--A Knight's Journey
DescriptionBackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journeyaround the world. Whenever a knight moves, it is原创 2013-02-27 14:08:01 · 593 阅读 · 0 评论 -
POJ1129--Channel Allocation
DescriptionWhen a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a strong signal. However, the channels used by each rep原创 2013-03-06 16:52:45 · 690 阅读 · 0 评论 -
POJ2676--Sudoku
DescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 t原创 2013-03-06 16:16:10 · 891 阅读 · 0 评论 -
POJ1416--Shredding Company
DescriptionYou have just been put in charge of developing a new shredder for the Shredding Company Although a "normal" shredder would just shred sheets of paper into little pieces so that the conten转载 2013-03-06 15:16:12 · 915 阅读 · 0 评论 -
POJ1062--昂贵的聘礼--DFS
Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换原创 2013-02-20 12:52:02 · 606 阅读 · 0 评论 -
POJ3083--Children of the Candy Corn
DescriptionThe cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopaths, hippies, and other terro原创 2013-03-04 10:23:30 · 571 阅读 · 0 评论 -
POJ3740--Easy Finding
DescriptionGiven a M×N matrix A. Aij ∈ {0, 1} (0 ≤ i < M, 0 ≤ j < N), could you find some rows that let every cloumn contains and only contains one 1.InputThere are multiple cases ende原创 2013-03-03 19:34:11 · 553 阅读 · 0 评论 -
POJ1691--Painting A Board
DescriptionThe CE digital company has built an Automatic Painting Machine (APM) to paint a flat board fully covered by adjacent non-overlapping rectangles of different sizes each with a predefined原创 2013-07-24 18:52:12 · 1236 阅读 · 0 评论