Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - 1753 poj
Search - 1753 poj - List
poj 1753 Flip Game 采用广搜来枚举所有状态得到最优解-poj 1753 Flip Game widely used to enumerate all the state found to be the optimal solution
Date : 2025-07-02 Size : 1kb User : zl

DL : 0
用位操作+BFS解决.基本思想如下:给棋盘每一个状态赋予一个状态id,id计算方法是将棋盘与数的二进制表示联系起来,如题所给的数据:bwwbbbwbbwwbbwww状态id为6585,计算方法为1*2^0+0*2^1+1*2^2..1*2^12+0*2^13..=6585(其中b代表1,w代表0)在此基础上进行BFS搜索,首先理解一点,先点(0,0)再点(0,1)与先点(0,1)再点(0,0)对结果不造成任何影响.因此遍历棋盘的16个位置,将每次点击后的状态id利用树状结构保存.如-poj 1753
Date : 2025-07-02 Size : 1kb User : lzr
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.