摘要: 以走迷宫需要的最少步数的代码为例 #include<stdio.h>#include<string.h>#include<queue> using namespace std; struct Note{ int x,y,s;};int a[51][51],book[51][51]; void bfs 阅读全文
posted @ 2017-04-29 18:34 Been_You1997 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 首先用广度优先搜索来枚举出所有小人能够到达的点,并计算出每个点能够消灭的敌人的数量。如果下一个点能够消灭的敌人数量大于前一个,那么更新消灭敌人数量的最大值,并更新坐标点。下面是代码。 #include<stdio.h>#include<queue>#include<string.h> using n 阅读全文
posted @ 2017-04-29 18:23 Been_You1997 阅读(188) 评论(0) 推荐(0) 编辑