T7_C24_JSD_78 @ 2024-10-26 20:10:39
#include<bits/stdc++.h>
using namespace std;
char a[1000][1000];
int n,m,t,k,kkk,b[1005][1005],e,c[4][4],x,y,d;
int main() {
cin>>t;
c[0][1]=0,c[0][2]=1;
c[1][1]=1,c[1][2]=0;
c[2][1]=0,c[2][2]=-1;
c[3][1]=-1,c[3][2]=0;
while(t--){
cin>>n>>m>>k>>x>>y>>d;
kkk=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];b[i][j]=0;
}
}
b[x][y]++;
for(int i=1;i<=k;i++){
x+=c[d][1],y+=c[d][2];
if(x>n or y>m or x<1 or y<1 or a[x][y]=='x'){
x-=c[d][1],y-=c[d][2];
d=(d+1)%4;
}
else b[x][y]++;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(b[i][j]!=0) kkk++;
}
}
cout<<kkk<<endl;
}
return 0;
}
是数据开小了吗?
by wujunrui2012 @ 2024-10-26 20:14:06
好像是可以a的
by wujunrui2012 @ 2024-10-26 20:14:49
你开o2试试
by BDMsx @ 2024-10-26 20:37:28
哪个测试点出错了,报的什么?
by KingkongLi @ 2024-10-26 20:38:09
char数组越界了
by KingkongLi @ 2024-10-26 20:38:54
1000*1000只能访问a[0][0]-a[999][999]
by T7_C24_JSD_78 @ 2024-10-27 09:54:53
@KingkongLi A了
by KingkongLi @ 2024-10-27 10:18:35
@T7_C24_JSD_78求关qwq