求助
查看原帖
求助
793625
Pink_Cut_Tree楼主2023/5/9 21:50
#include<bits/stdc++.h>
using namespace std;
bool gr[1005][1005];
int main(){
	int n,m,r,x,y;
	cin>>n>>m>>r;
	while(m--){
		cin>>x>>y;
		for(int i=(x-r)<0?1:x-r;i<=x+r;i++){
			for(int j=(y-r)<0?1:y-r;j<=y+r;j++){
				gr[i][j]=true;
			}
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(gr[i][j]==true){
				ans++;
			}
		}
	}
	cout<<ans;
return 0;
}

判断边界了,后6个点WA掉

第5个:

in

100 10 22
59 48
3 54
83 43
90 25
70 27
25 88
7 94
43 58
22 16
85 47

out

7673

我的输出

8350
2023/5/9 21:50
加载中...