2012年7月8日

poj 2965 枚举搜索

摘要: 这题跟POJ1753 flip game 思想一样。。唯一不同得是这题要保存方案。用c++一直超时,g++500多ms.View Code #include <stdio.h>#include <string.h>#include <iostream>#include <queue>#include <stack>using namespace std;int visit[70000];char mp[1100];struct node{ int state; int num;}p;struct pnode{ int x, y;}px 阅读全文

posted @ 2012-07-08 19:58 more think, more gains 阅读(139) 评论(0) 推荐(0) 编辑

poj 1753 Flip game 枚举

摘要: BFS搜索 + 位运算提速。。枚举每一个状态, 进行up, left, down, right操作。。当状态state = 0xffff 或0时,说明全部为黑或白。。。对于一个状态没有访问过就入队,并且标志为已访问。。View Code #include <iostream>#include <cstdlib>#include <stdlib.h>#include <string.h>#include <stdio.h>#include <queue>using namespace std;char mp[100];int 阅读全文

posted @ 2012-07-08 17:02 more think, more gains 阅读(148) 评论(0) 推荐(0) 编辑

导航