题目链接:https://ac.nowcoder.com/acm/contest/331/I
按找题意模拟就好了...代码略丑,不想改了...
AC代码:
#include
using namespace std;
string str[505];
int n,m,pos;
bool flag;
void dfs(int x,int y,int h){
while(1){
if(x == -1 || y == -1 || x == n || y == m){
if(x == n) flag = true, pos = y + 1;
break;
}
// cout<= 0 && y >= 0 && x < n && y < m && str[x][y] != '.'){
// cout<= 0 && y >= 0 && x < n && y < m && str[x][y] == '.'){
if(h == 0)x = x + 1;
if(h == 1)x = x - 1;
if(h == 2)y = y - 1;
if(h == 3)y = y + 1;
}
}
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=0;i>str[i];
}
for(int i=0;i