POJ 2286 The Rotation Game(IDA*)】的更多相关文章

The Rotation Game Time Limit: 15000MS   Memory Limit: 150000K Total Submissions: 6396   Accepted: 2153 Description The rotation game uses a # shaped board, which can hold 24 pieces of square blocks (see Fig.1). The blocks are marked with symbols 1, 2…
IDA*算法,即迭代加深的A*算法.实际上就是迭代加深+DFS+估价函数 题目传送:The Rotation Game AC代码: #include <map> #include <set> #include <list> #include <cmath> #include <deque> #include <queue> #include <stack> #include <bitset> #include…
The Rotation Game Time Limit: 15000MS   Memory Limit: 150000K Total Submissions: 5691   Accepted: 1918 Description The rotation game uses a # shaped board, which can hold 24 pieces of square blocks (see Fig.1). The blocks are marked with symbols 1, 2…
题目大意:数字1,2,3都有八个,求出最少的旋转次数使得图形中间八个数相同.旋转规则:对于每一长行或每一长列,每次旋转就是将数据向头的位置移动一位,头上的数放置到尾部.若次数相同,则找出字典序最小旋转次序. 题目分析:IDA*,若当前在第cur层,中间八个数中1,2,3的个数分别为a,b,c.则d=8-max(a,b,c)便是达到目标还需要的理想次数,若cur+d>maxd,则剪枝.<入门经典>上提供了一种BFS的思路,分别以1,2,3为目标广搜3次,不过自己的码力还是太弱,并没有用那种…
题目 题目     分析 lrj代码.... 还有is_final是保留字,害的我CE了好几发.     代码 #include <cstdio> #include <algorithm> using namespace std; int line[8][7]={ { 0, 2, 6,11,15,20,22}, // A { 1, 3, 8,12,17,21,23}, // B {10, 9, 8, 7, 6, 5, 4}, // C {19,18,17,16,15,14,13},…
POJ 1979 Red and Black (红与黑) Time Limit: 1000MS    Memory Limit: 30000K Description 题目描述 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…
POJ 3268 Silver Cow Party (最短路径) Description One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way roads c…
POJ.3087 Shuffle'm Up (模拟) 题意分析 给定两个长度为len的字符串s1和s2, 接着给出一个长度为len*2的字符串s12. 将字符串s1和s2通过一定的变换变成s12,找到变换次数 变换规则如下: 假设s1=12345,s2=67890 变换后的序列 s=6172839405 如果s和s12完全相等那么输出变换次数 如果不完全相等,s的前半部分作为s1,后半部分作为s2,重复上述过程. 直接模拟,注意给出的顺序是从底到上的. 代码总览 #include <cstdio…
POJ.1426 Find The Multiple (BFS) 题意分析 给出一个数字n,求出一个由01组成的十进制数,并且是n的倍数. 思路就是从1开始,枚举下一位,因为下一位只能是0或1,故这个数字只能是1 * 10或者1 * 10 + 1.就按照这种方式枚举,依次放入队列,如果是其的倍数,就输出. 一开始没理解题意,以为是找一个能整除的二进制数,错了半天. 代码总览 #include <cstdio> #include <cstring> #include <algo…
Description The Leiden University Library has millions of books. When a student wants to borrow a certain book, he usually submits an online loan form. If the book is available, then the next day the student can go and get it at the loan counter. Thi…