有没有人帮忙在洛谷上交一下

#include<bits/stdc++.h>
using namespace  std;
int n,m,boom[505][505],q; 
int  main( ) 
{
    cin>>n>>m>>q;
    for (int i=1;i<=q;i++)
    {
        int x,y;
        cin>>x>>y;
        boom[x][y]=INT_MIN;
        boom[x-1][y+1]++;
        boom[x-1][y-1]++;
        boom[x-1][y]++;
        boom[x+1][y+1]++;
        boom[x+1][y-1]++;
        boom[x+1][y]++;
        boom[x][y+1]++;
        boom[x][y-1]++;
    }
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=m;j++)
        {
            if (boom[i][j]<0)
                cout<<"*";
            else
                cout<<boom[i][j];
            cout<<' ';
        }
        cout<<endl;
    }
    return 0;   
}

1 条评论

  • 1

信息

ID
3130
难度
5
分类
(无)
标签
递交数
24
已通过
12
通过率
50%
上传者