大佬们,逼人自作主张写了个不知所云的玩意,但全RE 请问是根本就不能这么写还是哪里有问题,谢谢大佬! (悬赏我这不值钱的关注)
#include<bits/stdc++.h>
using namespace std;
long long n,m;
char c[1000][1000];
long long x[1000],y[1000];
long long ans;
long long a = 1;
int main()
{
cin >> n >> m;
for(long long i = 1; i <= n; i++)
{
for(long long j = 1; j <= m; j++)
{
cin >> c[i][j];
if(c[i][j] == '0')
{
x[a] = i;
y[a] = j;
a++;
}
}
}
for(long long i = 1; i <= a - 1; i++)
{
if(x[i] != 0 and y[i] != 0 and c[x[i] + 1][y[i]] == '*' and c[x[i] - 1][y[i]] != '0' and c[x[i]][y[i] + 1] != '0' and c[x[i]][y[i] - 1] != '0')
{
ans++;
}
}
cout << ans;
return 0;
}