悬赏各位dalao(关注)
  • 板块灌水区
  • 楼主dingpeng1234
  • 当前回复9
  • 已保存回复9
  • 发布时间2022/8/9 10:56
  • 上次更新2023/10/27 16:20:10
查看原帖
悬赏各位dalao(关注)
606996
dingpeng1234楼主2022/8/9 10:56

why?

P1789 【Mc生存】插火把

为什么会RE?

#include<bits/stdc++.h>
using namespace std;
int a[105][105],n,m,k,x,y,cnt;
int main(){
    cin>>n>>m>>k;
    for(int i=1;i<=m;i++){
        cin>>x>>y;
        for(int i=x-1;i<=x+1;i++) for(int j=y-1;j<=y+1;j++) a[i][j]=true;
	    a[x-2][y]=true;
	    a[x+2][y]=true;
	    a[x][y+2]=true;
	    a[x][y-2]=true;
    }
    for(int i=1;i<=k;i++){
        cin>>x>>y;
        for(int i=x-2;i<=x+2;i++) for(int j=y-2;j<=y+2;j++) a[i][j]=true;
    }
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++) if(a[i][j]==0) cnt++;
    cout<<cnt;
    return 0;
}

点这里

请求dalao帮忙!!!

2022/8/9 10:56
加载中...