###大佬求解
查看原帖
###大佬求解
381665
郑一诺12345楼主2022/3/8 21:43
#include<bits/stdc++.h>
using namespace std;
int n,m,k,ans,a[104][104];
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for (int i=1;i<=m;++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		x+=3;y+=3;
		a[x][y]=a[x+1][y]=a[x+2][y]=a[x-1][y]=a[x-2][y]=a[x][y+1]=a[x][y+2]=a[x][y-1]=a[x][y-2]=a[x-1][y-1]=a[x+1][y+1]=a[x+1][y-1]=a[x-1][y+1]=1;
	}
	for (int i=1;i<=k;++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		x+=3;y+=3;
		for (int b=x-3;b<=x+3;++b)
		for (int c=y-3;c<=y+3;++c)
		a[b][c]=1;
	}
	for (int i=4;i<=n+3;++i)
	for (int j=4;j<=n+3;++j)
	if (a[i][j]==0)
	ans++;
	printf("%d\n",ans);
	return 0;
}

2,3两点能过1,4,5两点过不了

2022/3/8 21:43
加载中...