吧主顺利的当上了!
iban001吧
全部回复
仅看楼主
level 6
iban001 楼主
呵呵呵
2012年01月10日 08点01分 1
level 2
[Yeah]
2012年01月10日 09点01分 2
level 2
贺喜~
2012年01月10日 15点01分 4
level 6
iban001 楼主
跟我的名字一样。就当是空间了
2012年01月11日 09点01分 5
level 6
iban001 楼主
啊哈
2012年01月11日 09点01分 6
level 1
#include<cstdio>
#include<cstring>
int vis[6]={*I*,*E*,*H*,*O*,*V*,*A*};
char table[10][10];
int i,j;
int startx,starty;
int finishx,finishy;
int count;
int m,n;
void print()
{
for(i=0;i<m;i++)
for(j=0;j<n;j++)
printf("%c%c",table[i][j],(j==n-1)?*\n*:* *);
printf("%d %d///%d %d\n",startx,starty,finishx,finishy);
}
void search(int x,int y)
{
if( x+1<n && (table[y][x+1]==vis[count] || table[y][x+1]==*#*)) {printf("right%c",(count!=6)?* *:*\n*);count++;search(x+1,y);}
if( x-1>=0 && (table[y][x-1]==vis[count] || table[y][x-1]==*#*)) {printf("left%c",(count!=6)?* *:*\n*);count++;search(x-1,y);}
if( y-1>=0 && (table[y-1][x]==vis[count] || table[y-1][x]==*#*)) {printf("forth%c",(count!=6)?* *:*\n*);count++;search(x,y-1);}
if( y+1<m && (table[y+1][x]==vis[count] || table[y+1][x]==*#*)) {printf("forth%c",(count!=6)?* *:*\n*);count++;search(x,y+1);}
}
int main()
{
int ct=0;
int le;
scanf("%d",&le);
while(le--){
while(~scanf("%d%d",&m,&n)){
getchar();
getchar();
ct++;
if(ct!=1) printf("\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++){
scanf("%c",&table[i][j]);
if(table[i][j]==*#*) {finishx=j;finishy=i;}
if(table[i][j]==*@*) {startx=j;starty=i;}
}
if(i!=m-1){
getchar();
getchar();
}
}
count=0;
search(startx,starty);
}
}
return 0;
}
/*
2
6 5
PST#T
BTJAS
TYCVM
YEHOF
XIBKU
N@RJB
5 4
JA#X
JVBN
XOHD
DQEM
T@IY
*/
2014年09月29日 13点09分 7
level 6
iban001 楼主
由于
2015年01月02日 14点01分 8
level 6
iban001 楼主
uh
2015年01月02日 14点01分 9
level 6
iban001 楼主
2016年10月24日 00点10分 10
1