AT的C莫名其妙挂掉了…………
不明白哪里有问题
大佬膜拜QwQ
#include<bits/stdc++.h>
using namespace std;
char c[1001][1001];
bool good[1001][1001];
#define int long long
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int h,w,d;
cin>>h>>w>>d;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>c[i][j];
good[i][j]=1;
}
}
int ans=0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(c[i][j]=='H'){
if(good[i][j]){
ans++;
good[i][j]=0;
}
for(int k=0;k<=d;k++){
if(c[i+k][j]=='.' || c[i+k][j]=='H'){
if(good[i+k][j]){
ans++;
good[i+k][j]=0;
}
}
}
for(int k=0;k<=d;k++){
if(c[i-k][j]=='.' || c[i-k][j]=='H'){
if(good[i-k][j]){
ans++;
good[i-k][j]=0;
}
}
}
for(int k=0;k<=d;k++){
if(c[i][j+k]=='.' || c[i][j+k]=='H'){
if(good[i][j+k]){
ans++;
good[i][j+k]=0;
}
}
}
for(int k=0;k<=d;k++){
if(c[i][j-k]=='.' || c[i][j-k]=='H'){
if(good[i][j-k]){
ans++;
good[i][j-k]=0;
}
}
}
}
}
}
cout<<ans<<endl;
return 0;
}