原题地址: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1019
简单的搜索题就是要小心一些:
#include<stdio.h>
typedef struct step
{
int x,y;
char direction;
}step;
step steps[10000];
int maps[101][101];
int m,n,flag;
int work(int x,int y,int mark)
{
int i,j,xn,yn;
char p;
if(x<1||x>m||y<1||y>n||maps[x][y])return 0;
if( mark == flag) return 1;
xn = x; yn = y;
for(i=steps[mark].x;i<=steps[mark].y;i++)
{
p=steps[mark].direction;
if(p=='U')......
阅读全文