概述
bfs失败。mark
我他妈服了自己/cy
注释
#include<iostream>
#include<vector>
#include<cstring>
#include<queue>
using namespace std;
const int N = 15;
int r1, c1, dir;
int end_r, end_c;
char title[1000];
const char* dirs = "NESW";
const char* turns = "FLR";
const int dr[] = { -1,0,1,0 };
const int dc[] = { 0,1,0,-1 };
int dir_id(char c) { return strchr(dirs, c) - dirs; }
int turn_id(char c) { return strchr(turns, c) - turns; }
struct Node {
int r, c, dir;
Node() {};
//Node (Node&t) :r(t.r), c(t.c), dir(t.dir) {};
};
int d[N][N][4];
Node P[N][N][4];
bool has_edge[N][N][4][3];
int input();
Node walk(Node &u, int turn);
void slove();
void print_path(Node u);
int main() {
while (input()) {
slove();
//cout << "input sucessfullyn";
}
}
int input() {
scanf("%s", title);
if (strcmp(title, "END") == 0)
return 0;
printf("%sn", title);
int r, c;char Dir;char s[1000];
cin >> r >> c;scanf(" %c", &Dir);cin >> end_r >> end_c;
dir = dir_id(Dir);
r1 = r + dr[dir_id(Dir)];
c1 = c + dc[dir_id(Dir)];
while (cin >> r && r) {
cin >> c;
while (scanf("%s", s)) {
if (strcmp(s, "*") != 0) {
for (int i = 1;s[i] != '