题中保证右下角不为 *。
可是以下代码能证明第三个点中的某个数据右下角为 *。
#include<bits/stdc++.h>
using namespace std;
int n,m;
int minn=899999;
char a[23][23];
int d[23][23];
struct node{
int sx,sy,sstep;
};
queue<node>q;
int ans;
int dx[7]={0,1,0,0,-1};
int dy[7]={0,0,-1,1,0};
int main(){
int T;cin>>T;
for(int ik=1;ik<=T;ik++){
cin>>n>>m;
ans=0;
memset(d,0,sizeof d);
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
}
}
if(a[n][m]=='*'){
while(true);
}
if(ans==0)cout<<"-1"<<endl;
else cout<<ans<<endl;
}
return 0;
}
提交记录
@kkksc03