摘要:
以走迷宫需要的最少步数的代码为例 #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 阅读全文
摘要:
首先用广度优先搜索来枚举出所有小人能够到达的点,并计算出每个点能够消灭的敌人的数量。如果下一个点能够消灭的敌人数量大于前一个,那么更新消灭敌人数量的最大值,并更新坐标点。下面是代码。 #include<stdio.h>#include<queue>#include<string.h> using n 阅读全文