摘要: 主要运用BFS把一个’@‘所在的油田的‘@’都标记(既改为‘*’),然后不断的找’@‘,重复刚才那一步,直到找不到’@‘为止;记录找的次数;#include #include #include "string.h"using namespace std;struct spot{public: int... 阅读全文
posted @ 2014-07-14 23:09 Mr.XuJH 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 利用广度优先搜索,对可以达到的“.”进行统计;每一个点对应有4个方向,每一个都去尝试#include #include #include using namespace std;struct tile{public: int x,y; void init(int nx,int ny){ x=nx; ... 阅读全文
posted @ 2014-07-14 17:30 Mr.XuJH 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 这一题主要用到了BFS广度优先算法 若马的当前位置为(x,y),那么下一步就有8种可能。(x+2 , y+1) , (x+1 , y+2 ) , (x-1 , y+2) , (x-2 , y+1)(x+2 , y -1) , (x+1 , y-2 ) , (x-1 , y-2) , (x-2 , y... 阅读全文
posted @ 2014-07-14 15:54 Mr.XuJH 阅读(130) 评论(0) 推荐(0) 编辑