题目链接
http://noi-test.zzstep.com/contest/0x29%E3%80%8C%E6%90%9C%E7%B4%A2%E3%80%8D%E7%BB%83%E4%B9%A0/2906%20%E6%AD%A6%E5%A3%AB%E9%A3%8E%E5%BA%A6%E7%9A%84%E7%89%9B
分析
状态为牛的位置,分八个方向逐步扩展即可。
AC代码
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
inline int read() {
int num = 0;
char c = getchar();
while (c < '0' || c > '9') c = getchar();
while (c >= '0' && c <= '9')
num = num * 10 + c - '0', c = getchar();
return num;
}
const int maxn = 155;
const int nxt[8][2] = {