POJ 2286 The Rotation Game

康复计划 之 ida* 题意: 这种玩具要你操作最少次数且操作字典序最小,使得中间的8个数字相同。 思路: 迭代加深 启发式 搜索 估价函数采用 8 – 中间数字最多的数字数量 因为每次操作如果想达到最终结果,一次最多只能转化出一个,如 aaab ,一次转化出两个的话,中间那个必定不相同,可以自己在纸上试试。 这道题本身在深搜层数上并不会很大,ida * 的优势就体现了出来。 AC Code #include #include #include #include #include using namespace std; vector ans; int ary[30], deep; int center[] = { 7, 8, 9, 12, 13, 16, 17, 18 }; int