代码如下,我在自己电脑用VS2019可以正常编译,答案也没问题,但是提交上去一直报错
#include <iostream>
int main()
{
int num = 1, n, m, k, a[102][102] = { 0 };
scanf_s("%d%d%d",&n,&m,&k);
int mx = 0, my = 0, kx = 0, ky = 0;
mx += 2; my += 2; kx += 2; ky += 2;
while (num <= m)
{
scanf_s("%d%d", &mx, &my);
a[mx][my] = { 1 };
a[mx+1][my] = { 1 };
a[mx+2][my] = { 1 };
a[mx-1][my] = { 1 };
a[mx-2][my] = { 1 };
a[mx][my+1] = { 1 };
a[mx][my+2] = { 1 };
a[mx][my-1] = { 1 };
a[mx][my-2] = { 1 };
a[mx-1][my+1] = { 1 };
a[mx-1][my-1] = { 1 };
a[mx+1][my+1] = { 1 };
a[mx+1][my-1] = { 1 };
num++;
}
num = 1;
if (k>0)
{
while (num <= k)
{
scanf_s("%d%d", &kx, &ky);
a[kx][ky] = { 1 };
for (int add = 0; add < 5; add++)
{
for (int add2 = 0; add2 < 5; add2++)
a[kx - 2 +add][ky - 2 + add2] = { 1 };
}
num++;
}
}
int number = 0;
for (int i = 1; i<= n; i++)
{
for (int j = 1;j <= n; j++)
{
if (a[i][j] != 1)
number++;
}
}
printf("%d",number);
return 0;
}