
dfs
文章平均质量分 61
ctsas
这个作者很懒,什么都没留下…
展开
-
Sticks --dfs 剪枝
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had origi原创 2017-02-05 19:21:44 · 220 阅读 · 0 评论 -
[poj]3187 Backward Digit Sums [dfs]
FJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (1 <= N <= 10) in a certain order and then sum adjacent numbers to produce a new list with one fewer number. They re原创 2017-03-07 17:43:06 · 285 阅读 · 0 评论 -
[HDU] 5311 Hidden String [DFS]
Today is the 1st anniversary of BestCoder. Soda, the contest manager, gets a string ss of length nn. He wants to find three nonoverlapping substrings s[l1..r1]s[l_1..r_1], s[l2..r2]s[l_2..r_2], s[l3..r原创 2017-03-08 21:17:41 · 317 阅读 · 0 评论 -
计算直线的交点数 [dfs]
Description 平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点数。 比如,如果n=2,则可能的交点数量为0(平行)或者1(不平行)。Input 输入数据包含多个测试实例,每个测试实例占一行,每行包含一个正整数n(n<=20),n表示直线的数量. Output 每个测试实例对应一行输出,从小到大列出所有相交方案,其中每个数为可能的交点数,每行的整数之间用一个空格隔开。S原创 2017-03-08 17:35:43 · 499 阅读 · 0 评论 -
棋盘问题 dfs
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n 当为-1 -1原创 2017-02-03 22:23:08 · 237 阅读 · 0 评论 -
深度优先搜索集合的所有组合的一半 [优化][笔记]
个人笔记原创 2017-02-15 21:31:15 · 416 阅读 · 0 评论 -
[HDU] 1010 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原创 2017-03-02 15:17:03 · 249 阅读 · 0 评论 -
[poj] 1979 Red and Black [dfs]
DescriptionThere 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 adjacent tiles. B原创 2017-03-01 17:50:23 · 318 阅读 · 0 评论 -
昂贵的聘礼 [DFS][最短路]
Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:”嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。”探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者原创 2017-02-20 22:15:48 · 263 阅读 · 0 评论 -
Fliptile [反转问题][dfs]
DescriptionFarmer 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 × N grid (1 ≤ M ≤ 15;原创 2017-02-11 15:42:36 · 257 阅读 · 0 评论 -
2n皇后问题 [dfs][一个高效的优化]
题目描述给定一个n*n的棋盘,棋盘中有一些位置不能放皇后。现在要向棋盘中放入n个黑皇后和n个白皇后,使任意的两个黑皇后都不在同一行、同一列或同一条对角线上,任意的两个白皇后都不在同一行、同一列或同一条对角线上。问总共有多少种放法?输入输入的第一行为一个整数n,表示棋盘的大小。接下来n行,每行n个0或1的整数,如果一个整数为1,表示对应的位置可以放皇后,如果一个整数为0,表示对应的位置不可以放皇后。n原创 2017-02-08 19:15:02 · 681 阅读 · 0 评论 -
Super Jumping! Jumping! Jumping!
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The game can be原创 2017-02-07 16:46:58 · 340 阅读 · 0 评论 -
A Knight's Journey [dfs]
BackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is two squares in one原创 2017-02-06 21:22:27 · 314 阅读 · 0 评论 -
Children of the Candy Corn [bfs][dfs]
The 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 terrors on their ques原创 2017-02-06 19:59:52 · 340 阅读 · 0 评论 -
Flip Game dfs
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 each piece is lying either it's bl原创 2017-02-05 23:08:15 · 298 阅读 · 0 评论 -
codeforces /782/problem/C [dfs]
C. Andryusha and Colored Balloonstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAndryusha goes through a原创 2017-04-04 09:50:31 · 450 阅读 · 0 评论