furina_1013 @ 2024-11-04 22:28:46
#include<bits/stdc++.h>
using namespace std;
int n,m,k;
bool dt[105][105];//地图
bool vis[105][105];//是否被访问
int t;
int yd1[5]={0,1,0,-1};
int yd2[5]={1,0,-1,0};
int d,xx,yy;//朝向及方位
char furina;//点阵状态
int fufufu;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
freopen("explore.in","r",stdin);
freopen("explore.out","w",stdout);
cin>>t;
for(int fufu=1;fufu<=t;fufu++)
{
cin>>n>>m>>k;
cin>>xx>>yy>>d;
int ans=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
vis[i][j]=0;
cin>>furina;
if(furina=='x')fufufu=1;//不可通过
if(furina=='.')fufufu=0;
dt[i][j]=fufufu;
}
}
for(int i=1;i<=k;i++)
{
int x_nextt=xx+yd1[d];
int y_nextt=yy+yd2[d];
if(x_nextt<=n && x_nextt>=1 && 1<=y_nextt && y_nextt<=m && dt[x_nextt][y_nextt]==0)
{
xx=x_nextt;
yy=y_nextt;
if(vis[xx][yy]==0)
{
ans++;
vis[xx][yy]=1;
}
}
else
{
d=(d+1)%4;
}
}
cout<<ans<<"\n";
}
return 0;
}
by a31325365476587687 @ 2024-11-04 22:30:11
数组开小了
by furina_1013 @ 2024-11-04 22:45:01
啊啊?
by furina_1013 @ 2024-11-04 22:46:02
开大点50 @Zhr100102
by taqingqiu @ 2024-11-04 22:51:35
t2挂了?
by furina_1013 @ 2024-11-05 22:32:52
@taqingqiu
对啊,退了