随笔分类 -  递归与回溯

摘要:题目链接:P1002 解题思路: 递推得到从A到B点的方法数,如果遇到控制点,则到达该点的方法数为0 AC代码: 1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 long long g[21][21]; 5 int 阅读全文
posted @ 2020-09-08 13:53 不敢说的梦 阅读(162) 评论(0) 推荐(0)
摘要:题目链接:POJ 3414 Describe: You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i) f 阅读全文
posted @ 2020-09-02 22:35 不敢说的梦 阅读(204) 评论(0) 推荐(0)
摘要:题目链接:POJ 3126 Describe: The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to ch 阅读全文
posted @ 2020-09-02 09:06 不敢说的梦 阅读(151) 评论(0) 推荐(0)
摘要:题目链接:POJ 3278 Describe: 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 阅读全文
posted @ 2020-09-01 09:25 不敢说的梦 阅读(157) 评论(0) 推荐(0)
摘要:题目链接:POJ 2251 Describe: 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 阅读全文
posted @ 2020-08-23 21:13 不敢说的梦 阅读(122) 评论(0) 推荐(0)
摘要:Describe: The Sultan of Nubia has no children, so she has decided that the country will be split into up to k separate parts on her death and each par 阅读全文
posted @ 2020-08-03 16:46 不敢说的梦 阅读(152) 评论(0) 推荐(0)
摘要:八皇后问题 众所周知,八皇后问题,就是给你一个8*8的棋盘,你有8个皇后棋子,如何摆放棋子,使得他们不互相攻击,也就是说,如何摆放,使得任意两个棋子不在同一行,不在同一列,也不在同一个对角线。已经知道,有92种摆法。 思路解析 这是一道经典的回溯问题,很容易想到,我们可以搜索每一个位置,如果这个位置 阅读全文
posted @ 2020-08-03 14:44 不敢说的梦 阅读(332) 评论(0) 推荐(0)
摘要:Descirbe: 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 阅读全文
posted @ 2020-08-03 11:33 不敢说的梦 阅读(120) 评论(0) 推荐(0)
摘要:Describe: In your job at Albatross Circus Management (yes, it's run by a bunch of clowns), you have just finished writing a program whose output is a 阅读全文
posted @ 2020-08-03 09:41 不敢说的梦 阅读(189) 评论(0) 推荐(0)