_HLB_ @ 2024-10-26 17:23:22
#include<bits/stdc++.h>
using namespace std;
int main(){
int T;
cin >> T;
for(int t=0;t<T;t++){
bool v[1005][1005];
memset(v,false,sizeof(v));
char M[1005][1005];
int n, m, k;
int x, y, d;
int ans = 0;
cin >> n >> m >> k;
cin >> x >> y >> d;
v[x][y] = true;
ans++;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin >> M[i][j];
}
}
for(int i=0;i<k;i++){
int x_, y_;
if(d==0) x_ = x, y_ = y+1;
if(d==1) x_ = x+1, y_ = y;
if(d==2) x_ = x, y_ = y-1;
if(d==3) x_ = x-1, y_ = y;
if((M[x_][y_]=='.')&&(1<=x_&&x_<=n)&&(1<=y_&&y_<=m))
x = x_, y = y_;
if(!v[x][y]) ans++, v[x][y] = true;
else
d = (d+1)%4;
}
cout << ans << endl;
}
system("pause");
return 0;
}
记录
by CSZ7943 @ 2024-10-26 17:28:59
@13929219832hcr 赛事代码咋获取的???
by _HLB_ @ 2024-10-26 17:31:33
自己又写了一遍
by xiaowenxu @ 2024-10-26 17:41:08
@13929219832hcr 我以为有什么高端的获取途径看来手搓代码才是王道