54 条题解
- 
  4Galileonardo LV 7 @ 2017-10-04 00:17:00 直接覆盖上去玩了。 
 #include <iostream>
 using namespace std;char a[105][105]; 
 int b[105][105];
 int n,m;
 char temp;int main(){ 
 cin>>n>>m;
 for(int i=1;i<=n;i++){
 for(int j=1;j<=m;j++){
 temp=getchar();
 if((temp=='*')||(temp=='?')){
 a[i][j]=temp;
 }else{
 a[i][j]=getchar();
 }
 }} 
 for(int i=1;i<=n;i++){
 for(int j=1;j<=n;j++){
 if(a[i][j]=='*'){
 for(int x=i-1;x<=i+1;x++){
 for(int y=j-1;y<=j+1;y++){
 b[x][y]++;
 }
 }
 }
 }
 }
 for(int i=1;i<=n;i++){
 for(int j=1;j<=m;j++){
 if(a[i][j]=='*'){
 cout<<'*';
 }else{
 cout<<b[i][j];
 }
 }
 cout<<endl;
 }
 return 0;
 }
- 
  2@ 2016-11-16 16:01:03
 #include<iostream> 
 #include<string.h>
 using namespace std;
 char a[105][105];
 int m,n,b[105][105];
 int c[16]={0,1,0,-1,1,0,-1,0,1,1,1,-1,-1,1,-1,-1};
 int main()
 {
 //freopen("b.in","r",stdin);
 //freopen("b.out","w",stdout);
 cin>>n>>m;
 memset(b,0,sizeof(b));
 for(int i=0;i<n;i++)
 {
 for(int j=0;j<m;j++)cin>>a[i][j];
 }
 for(int i=0;i<n;i++)
 {
 for(int j=0;j<m;j++)
 {
 if(a[i][j]=='*')
 {
 for(int k=0;k<16;k+=2)if(i+c[k]>=0&&i+c[k]<n&&j+c[k+1]>=0&&j+c[k+1]<m)b[i+c[k]][j+c[k+1]]++;
 }
 }
 }
 for(int i=0;i<n;i++)
 {
 for(int j=0;j<m;j++)
 {
 if(a[i][j]=='?')a[i][j]='0'+b[i][j];
 }
 }
 for(int i=0;i<n;i++)
 {
 for(int j=0;j<m;j++)cout<<a[i][j];
 cout<<endl;
 }
 return 0;
 }
 
- 
  1@ 2022-07-20 13:44:53#include <iostream> using namespace std; char a[105][105]; int b[105][105]; int n,m; char temp; int main(){ cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ temp=getchar(); if((temp=='*')||(temp=='?')){ a[i][j]=temp; }else{ a[i][j]=getchar(); } } } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(a[i][j]=='*'){ for(int x=i-1;x<=i+1;x++){ for(int y=j-1;y<=j+1;y++){ b[x][y]++; } } } } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(a[i][j]=='*'){ cout<<'*'; }else{ cout<<b[i][j]; } } cout<<endl; } return 0; }
- 
  1@ 2021-08-29 16:47:18#include<bits/stdc++.h> using namespace std; bool a[105][105]; int main() { memset(a,0,sizeof(a)); int n,m; char tmp; cin>>n>>m; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { cin>>tmp; if(tmp=='*') a[i][j]=1; } } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(a[i][j]==1) printf("*"); else { printf("%d",a[i+1][j+1]+a[i+1][j-1]+a[i+1][j]+a[i][j+1]+a[i][j-1]+a[i-1][j+1]+a[i-1][j]+a[i-1][j-1]); } } printf("\n"); } return 0; }
- 
  1@ 2021-02-26 08:41:54#include<bits/stdc++.h> using namespace std; int n,k,a[110][110],ans,t,m,l=1; char b[110][110]; int main() { //freopen("mine.in","r",stdin); //freopen("mine.out","w",stdout); cin>>n>>m; for(int i=1;i<=n;i=i+1) for(int j=1;j<=m;j++) cin>>b[i][j]; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(b[i][j]!='*') { if(b[i-1][j-1]=='*')a[i][j]++; if(b[i][j-1]=='*')a[i][j]++; if(b[i+1][j-1]=='*')a[i][j]++; if(b[i+1][j]=='*')a[i][j]++; if(b[i+1][j+1]=='*')a[i][j]++; if(b[i][j+1]=='*')a[i][j]++; if(b[i-1][j+1]=='*')a[i][j]++; if(b[i-1][j]=='*')a[i][j]++; } else a[i][j]=-1; } } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(a[i][j]!=-1)cout<<a[i][j]; else cout<<"*"; } cout<<endl; } return 0; }
- 
  1@ 2018-08-20 09:23:54/* 水题啊 直接乱搞不就好了 对于每一个点 我们来直接对于每一个点 就直接搜索一下八个方向个数就好 水题Orz */ #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespace std; const int MAXN=105; int n,m; int a[MAXN][MAXN]; int zx[8][2]={{-1,0},{-1,-1},{1,1},{0,-1},{1,0},{-1,1},{1,-1},{0,1}}; void init() { char ch; cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { cin>>ch; if(ch=='*') a[i][j]=-1; } } int gets(int x,int y) { int ans=0; for(int i=0;i<8;i++) { int newx=x+zx[i][0]; int newy=y+zx[i][1]; if(newx>n||newy>m||newx<1||newy<1) continue; if(a[newx][newy]==-1) ans++; } return ans; } int main() { init(); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(a[i][j]!=-1) a[i][j]=gets(i,j); for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) if(a[i][j]==-1) cout<<'*'; else cout<<a[i][j]; cout<<endl; } }
- 
  1@ 2017-10-02 21:45:56#include<iostream> 
 #include<cstdio>
 #include<algorithm>
 #include<cmath>
 using namespace std;
 char a[105][105];
 int b[105][105];
 int main()
 {
 //freopen("game.in","r",stdin);
 //freopen("game.out","w",stdout);
 int n,m;
 cin>>n>>m;
 for(int i=1;i<=n;i++)
 for(int j=1;j<=m;j++)
 {
 cin>>a[i][j];
 if(a[i][j]=='*')
 {
 b[i][j]=10;
 b[i+1][j]++;
 b[i][j+1]++;
 b[i+1][j+1]++;
 b[i+1][j-1]++;
 b[i][j-1]++;
 b[i-1][j-1]++;
 b[i-1][j]++;
 b[i-1][j+1]++;
 }
 }
 for(int i=1;i<=n;i++)
 {
 for(int j=1;j<=m;j++)
 {
 if(b[i][j]<10)
 cout<<b[i][j];
 else
 cout<<"*";
 }
 cout<<endl;
 }
 return 0;
 }
- 
  1@ 2017-01-23 00:50:25#include<stdio.h> 
 #include<stdlib.h>
 #include<string.h>
 char s[1001][1001];
 int main(){
 int i,j,k,n,m;
 scanf("%d%d\n",&n,&m);
 for(i=1;i<=n;i++){
 for(j=1;j<=m;j++)
 scanf("%c",&s[i][j]);
 if(i!=n)scanf("\n");
 }
 for(i=1;i<=n;i++){
 for(j=1;j<=m;j++)
 if(s[i][j]=='*')printf("*");
 else{
 int la=0;
 if(s[i-1][j]=='*')la++;
 if(s[i-1][j-1]=='*')la++;
 if(s[i-1][j+1]=='*')la++;
 if(s[i+1][j]=='*')la++;
 if(s[i+1][j-1]=='*')la++;
 if(s[i+1][j+1]=='*')la++;
 if(s[i][j-1]=='*')la++;
 if(s[i][j+1]=='*')la++;
 printf("%d",la);
 }
 printf("\n");
 }
 return 0;
 }
- 
  1@ 2016-11-11 22:03:48var n,m,i,j:longint; a,b:array[1..100,1..100] of char; begin fillchar(b,sizeof(b),'0'); readln(n,m); for i:=1 to n do begin for j:=1 to m do read(a[i,j]); readln; end; for i:=1 to n do for j:=1 to m do begin if a[i,j] = '?' then begin if j <> 1 then if a[i,j-1] = '*' then b[i,j]:=chr(ord(b[i,j])+1); //left if (i <> 1) and (j <> 1) then if a[i-1,j-1] = '*' then b[i,j]:=chr(ord(b[i,j])+1); //left up if i <> 1 then if a[i-1,j] = '*' then b[i,j]:=chr(ord(b[i,j])+1); //up if (i <> 1) and (j <> m) then if a[i-1,j+1] = '*' then b[i,j]:=chr(ord(b[i,j])+1); //right up if j <> m then if a[i,j+1] = '*' then b[i,j]:=chr(ord(b[i,j])+1); //right if (i <> n) and (j <> m) then if a[i+1,j+1] = '*' then b[i,j]:=chr(ord(b[i,j])+1); //right down if i <> n then if a[i+1,j] = '*' then b[i,j]:=chr(ord(b[i,j])+1); //down if (i <> n) and (j <> 1) then if a[i+1,j-1] = '*' then b[i,j]:=chr(ord(b[i,j])+1); //left down end; if a[i,j] = '*' then b[i,j]:='*'; end; for i:=1 to n do begin for j:=1 to m do write(b[i,j]); writeln; end; end.
- 
  1@ 2016-11-02 13:14:31#include<iostream> 
 #include<cstdio>
 #include<cstdlib>
 #include<cstring>
 #define N 101
 using namespace std;
 char a[N][N];
 int tot;
 int n,m;
 int search(int x,int y )
 {
 if(x-1>=1&&y-1>=1&&a[x-1][y-1]=='*')
 tot++;
 if(x+1<=n&&y+1<=m&&a[x+1][y+1]=='*')
 tot++;
 if(x-1>=1&&a[x-1][y]=='*')
 tot++;
 if(x-1>=1&&y+1<=m&&a[x-1][y+1]=='*')
 tot++;
 if(y-1>=1&&a[x][y-1]=='*')
 tot++;
 if(y+1<=m&&a[x][y+1]=='*')
 tot++;
 if(x+1<=n&&y-1>=1&&a[x+1][y-1]=='*')
 tot++;
 if(x+1<=n&&a[x+1][y]=='*')
 tot++;
 return tot;
 }
 int main()
 {
 cin>>n>>m;
 for(int i=1;i<=n;i++)
 for(int j=1;j<=m;j++)
 {
 cin>>a[i][j];
 }
 for(int i=1;i<=n;i++)
 {
 for(int j=1;j<=m;j++)
 {
 if(a[i][j] == '?')
 {
 tot=0;
 printf("%d",search(i,j));
 }
 if(a[i][j]=='*')
 printf("*");
 }
 cout<<endl;
 }
 return 0;
 }
- 
  1@ 2016-10-28 19:50:00#include <bits/stdc++.h> 
 using namespace std;
 char a[105][105];
 int b[105][105];
 bool c[105][105];
 int main()
 {
 int i,j,k,l,n,m;
 cin>>n>>m;
 memset(a,1,sizeof(c));
 for(i=1;i<=n;i++) {
 for(j=1;j<=m;j++) {
 cin>>a[i][j];
 if(a[i][j]=='*') {
 b[i][j]=-1000000;
 if(b[i+1][j]!=-1000000) b[i+1][j]++;
 if(b[i-1][j]!=-1000000) b[i-1][j]++;
 if(b[i][j+1]!=-1000000) b[i][j+1]++;
 if(b[i][j-1]!=-1000000) b[i][j-1]++;
 if(b[i+1][j+1]!=-1000000) b[i+1][j+1]++;
 if(b[i-1][j+1]!=-1000000) b[i-1][j+1]++;
 if(b[i+1][j-1]!=-1000000) b[i+1][j-1]++;
 if(b[i-1][j-1]!=-1000000) b[i-1][j-1]++;
 }
 }
 }
 for(i=1;i<=n;i++){
 for(j=1;j<=m;j++){
 if(b[i][j]!=-1000000) cout<<b[i][j];
 else cout<<"*";
 }
 cout<<endl;
 }
 return 0;
 }
 测试数据 #0: Accepted, time = 15 ms, mem = 624 KiB, score = 10测试数据 #1: Accepted, time = 0 ms, mem = 624 KiB, score = 10 测试数据 #2: Accepted, time = 15 ms, mem = 620 KiB, score = 10 测试数据 #3: Accepted, time = 0 ms, mem = 628 KiB, score = 10 测试数据 #4: Accepted, time = 0 ms, mem = 624 KiB, score = 10 测试数据 #5: Accepted, time = 15 ms, mem = 624 KiB, score = 10 测试数据 #6: Accepted, time = 0 ms, mem = 624 KiB, score = 10 测试数据 #7: Accepted, time = 15 ms, mem = 624 KiB, score = 10 测试数据 #8: Accepted, time = 0 ms, mem = 624 KiB, score = 10 测试数据 #9: Accepted, time = 15 ms, mem = 624 KiB, score = 10 Accepted, time = 75 ms, mem = 628 KiB, score = 100 
- 
  1@ 2016-10-14 13:58:57program ex2; 
 var i,j,l,t,m,n:integer;
 s:array[1..102,1..102] of char;
 a:array[1..102,1..102] of integer;
 b:array[1..102,1..102] of boolean;
 begin
 readln(n,m);
 for i:=1 to n+2 do
 for j:=1 to m+2 do
 begin
 s[i,j]:='?';
 a[i,j]:=0;
 end;
 for i:=2 to n+1 do
 begin
 for j:=2 to m+1 do
 begin
 read(s[i,j]);
 if s[i,j]='?' then b[i,j]:=true
 else b[i,j]:=false;
 end;
 readln;
 end;
 for i:=2 to n+1 do
 for j:=2 to m+1 do
 for l:=i-1 to i+1 do
 for t:=j-1 to j+1 do
 if s[l,t]='*' then a[i,j]:=a[i,j]+1;
 for i:=2 to n+1 do
 begin
 for j:=2 to m+1 do
 if b[i,j] then write(a[i,j])
 else write('*');
 writeln;
 end;
 end.
- 
  1@ 2016-10-02 11:21:25#include <iostream> 
 using namespace std;
 char a[107][107],b[107][107];
 int x[10]={1,1,1,0,0,0,-1,-1,-1},y[10]={1,0,-1,1,0,-1,1,0,-1},cur;
 int main()
 {
 int m,n;
 cin>>n>>m;
 for(int i=0;i<=n+2;i++)
 for(int j=0;j<=m+2;j++)
 a[i][j]='?';
 for(int i=1;i<=n;i++)
 for(int j=1;j<=m;j++)
 cin>>a[i][j];
 for(int i=1;i<=n;i++)
 {
 for(int j=1;j<=m;j++)
 {
 cur=0;
 if(a[i][j]=='*') cout<<"*";
 else
 {
 for(int k=0;k<=8;k++)
 if(a[i+x[k]][j+y[k]]=='*')
 cur++;
 cout<<cur;
 }
 }
 cout<<endl;
 }
 system ("pause");
 return 0;
 }
- 
  1@ 2016-09-04 19:47:34var a:array[0..100,0..100]of char; 
 n,m,t,i,j:longint;
 begin
 readln(n,m);
 for i:=1 to n do begin
 for j:=1 to m do
 read(a[i,j]);
 readln;
 end;
 for i:=1 to n do begin
 for j:=1 to m do begin
 t:=0;
 if a[i,j]='*' then write('*')
 else begin
 if a[i-1,j]='*' then inc(t);
 if a[i-1,j-1]='*' then inc(t);
 if a[i-1,j+1]='*' then inc(t);
 if a[i,j-1]='*' then inc(t);
 if a[i,j+1]='*' then inc(t);
 if a[i+1,j]='*' then inc(t);
 if a[i+1,j-1]='*' then inc(t);
 if a[i+1,j+1]='*' then inc(t);
 write(t);
 end;
 end;
 writeln;
 end;
 end.
 比赛现场打的,好傻啊。。。
- 
  1@ 2015-12-21 15:46:40记录信息 
 评测状态 Accepted
 题目 P1975 扫雷游戏
 递交时间 2015-12-20 16:50:50
 代码语言 Pascal
 评测机 VijosEx
 消耗时间 308 ms
 消耗内存 656 KiB
 评测时间 2015-12-20 16:50:51评测结果 
 编译成功Free Pascal Compiler version 2.6.2 [2013/02/12] for i386 
 Copyright (c) 1993-2012 by Florian Klaempfl and others
 Target OS: Win32 for i386
 Compiling foo.pas
 foo.pas(4,1) Note: Local variable "ip" not used
 foo.pas(4,4) Note: Local variable "op" not used
 Linking foo.exe
 33 lines compiled, 0.1 sec , 28864 bytes code, 1628 bytes data
 2 note(s) issued
 测试数据 #0: Accepted, time = 46 ms, mem = 652 KiB, score = 10测试数据 #1: Accepted, time = 31 ms, mem = 652 KiB, score = 10 测试数据 #2: Accepted, time = 31 ms, mem = 652 KiB, score = 10 测试数据 #3: Accepted, time = 31 ms, mem = 652 KiB, score = 10 测试数据 #4: Accepted, time = 31 ms, mem = 652 KiB, score = 10 测试数据 #5: Accepted, time = 46 ms, mem = 652 KiB, score = 10 测试数据 #6: Accepted, time = 31 ms, mem = 652 KiB, score = 10 测试数据 #7: Accepted, time = 31 ms, mem = 652 KiB, score = 10 测试数据 #8: Accepted, time = 15 ms, mem = 656 KiB, score = 10 测试数据 #9: Accepted, time = 15 ms, mem = 652 KiB, score = 10 Accepted, time = 308 ms, mem = 656 KiB, score = 100 代码 
 var
 l:array[1..200,1..200]of char;
 i,j,k,m,n:longint;
 ip,op:text;
 beginreadln(m,n); 
 fillchar(l,sizeof(l),'0');
 for i:=2 to m+1 do begin//这里从位置2,2开始读是为了避免下标越界报错
 for j:=2 to n+1 do read(l[i,j]);
 readln;//注意这里一定要写,不写会读错的
 end;
 for i:=2 to m+1 do begin
 for j:=2 to n+1 do begin
 if l[i,j]='*' then
 write('*');//如果是雷直接输出
 if l[i,j]='?' then begin
 k:=0;
 if l[i,j+1]='*' then inc(k);//if语句判断是否加一
 if l[i,j-1]='*' then inc(k);//同上
 if l[i+1,j]='*' then inc(k);//同上
 if l[i-1,j]='*' then inc(k);//同上
 if l[i+1,j+1]='*' then inc(k);//同上
 if l[i+1,j-1]='*' then inc(k);//同上
 if l[i-1,j+1]='*' then inc(k);//同上
 if l[i-1,j-1]='*' then inc(k);//同上
 write(k);
 end;
 end;
 writeln;//这边不加的话就变成一行了
 end;end. 
- 
  0@ 2024-09-08 12:27:15#include<iostream> using namespace std; char a[110][110]; int q[8][2] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}}; int main(){ ios::sync_with_stdio(false); int m, n, cnt = 0; cin >> m >> n; for(int i = m+1; i >= 0; i--){ for(int j = n+1; j >= 0; j--)a[i][j] = '?'; } for(int i = 1; i <= m; i++){ for(int j = 1; j <= n; j++)cin >> a[i][j]; } for(int i = 1; i <= m; i++){ for(int j = 1; j <= n; j++){ if(a[i][j] == '?'){ for(int k = 0; k < 8; k++){ if(a[i+q[k][0]][j+q[k][1]] == '*')cnt++; } cout << cnt; cnt = 0; }else cout << '*'; } cout << endl; } return 0; }
- 
  0@ 2018-06-21 15:22:59#include <iostream> 
 #include <cstdio>
 using namespace std;
 int main()
 {
 int n, m;
 cin>>n>>m;
 int i, j, count = 0;;
 char array[n][m];
 for(i = 0; i < n; i++) {
 for(j = 0; j < m; j++) {
 cin>>array[i][j];
 if(array[i][j] == '*')
 count++;
 }
 }
 if(count == n * m)
 {
 for(i = 0; i < n; i++) {
 for(j = 0; j < m; j++) {
 cout<<array[i][j];
 }
 cout<<endl;
 }
 }
 else
 {
 for(i = 0; i < n; i++) {
 for(j = 0; j < m; j++) {
 if(array[i][j] == '?')
 array[i][j] = '0';
 }
 }
 for(i = 0; i < n; i++) {
 for(j = 0; j < m; j++) {
 if(array[i][j] == '0')
 {
 if(array[i][j+1] == '*' && i < n && j + 1 < m && i >= 0 && j + 1 >= 0)
 array[i][j]++;
 if(array[i][j-1] == '*' && i < n && j - 1 < m && i >= 0 && j - 1 >= 0)
 array[i][j]++;
 if(array[i+1][j] == '*' && i + 1 < n && j < m && i + 1 >= 0 && j >= 0)
 array[i][j]++;
 if(array[i-1][j] == '*' && i - 1 < n && j < m && i - 1 >= 0 && j >= 0)
 array[i][j]++;
 if(array[i+1][j+1] == '*' && i + 1 < n && j + 1 < m && i + 1 >= 0 && j + 1 >= 0)
 array[i][j]++;
 if(array[i+1][j-1] == '*' && i + 1 < n && j - 1 < m && i + 1 >= 0 && j - 1 >= 0)
 array[i][j]++;
 if(array[i-1][j+1] == '*' && i - 1 < n && j + 1 < m && i - 1 >= 0 && j + 1 >= 0)
 array[i][j]++;
 if(array[i-1][j-1] == '*' && i - 1 < n && j - 1 < m && i - 1 >= 0 && j - 1 >= 0)
 array[i][j]++;
 }
 }
 }for(i = 0; i < n; i++) { 
 for(j = 0; j < m; j++) {
 cout<<array[i][j];
 }
 cout<<endl;
 }
 }
 return 0;
 }
- 
  0@ 2018-06-19 19:36:36#include<iostream> using namespace std; int main() { int n,m,map[102][102]={0}; char tmp; cin>>n>>m; for (int h=1;h<=n;h++) for (int l=1;l<=m;l++) { cin>>tmp; if (tmp=='*') map[h][l]=1; } for (int h=1;h<=n;h++) { for (int l=1;l<=m;l++) { if (map[h][l]==1) cout<<'*'; else { int tot=0; for (int lh=h-1;lh<=h+1;lh++) for (int ll=l-1;ll<=l+1;ll++) if (map[lh][ll]==1) tot++; cout<<tot; } } cout<<endl; } return 0; }
- 
  0@ 2017-06-04 13:01:17#include <cstring> 
 #include <iostream>
 using namespace std;
 char a[110][110];
 int m,n;
 int x[9]={0,1,1,1,0,0,-1,-1,-1};
 int y[9]={0,1,0,-1,1,-1,1,0,-1};
 int main()
 {
 cin>>m>>n;
 for(int i=1;i<=m;i++) cin>>a[i]+1;
 for(int i=1;i<=m;i++)
 {
 for(int j=1;j<=n;j++)
 if(a[i][j]=='*') cout<<"*";
 else
 {
 int flag=0;
 for(int t=1;t<=8;t++)
 flag+=(a[i+x[t]][j+y[t]]=='*');
 cout<<flag;
 }
 cout<<"\n";
 }
 return 0;
 }
- 
  0@ 2016-08-25 12:37:45这里只是102和105的区别,QAQ……………………………………………………………… 编译成功 测试数据 #0: RuntimeError, time = 15 ms, mem = 596 KiB, score = 0 
 测试数据 #1: RuntimeError, time = 15 ms, mem = 596 KiB, score = 0
 测试数据 #2: RuntimeError, time = 0 ms, mem = 596 KiB, score = 0
 测试数据 #3: RuntimeError, time = 15 ms, mem = 596 KiB, score = 0
 测试数据 #4: RuntimeError, time = 15 ms, mem = 596 KiB, score = 0
 测试数据 #5: RuntimeError, time = 0 ms, mem = 596 KiB, score = 0
 测试数据 #6: RuntimeError, time = 0 ms, mem = 596 KiB, score = 0
 测试数据 #7: RuntimeError, time = 0 ms, mem = 600 KiB, score = 0
 测试数据 #8: RuntimeError, time = 0 ms, mem = 596 KiB, score = 0
 测试数据 #9: RuntimeError, time = 0 ms, mem = 596 KiB, score = 0
 RuntimeError, time = 60 ms, mem = 600 KiB, score = 0
 代码
 c++
 #include<cstdio>
 #include<iostream>
 #include<cstring>
 using namespace std;
 int u[9]={-10,0,1,0,-1,1,1,-1,-1},w[9]={-10,1,0,-1,0,1,-1,1,-1};
 int main(void)
 {
 int a,b;
 cin>>a>>b;
 char maps[102][102];
 for(int i=1;i<=a;i++)
 for(int j=1;j<=b;j++)
 cin>>maps[i][j];
 int map[101][101];
 memset(map,0,sizeof(map));
 for(int i=1;i<=a;i++)
 for(int j=1;j<=b;j++)
 if(maps[i][j]=='*')map[i][j]=-1;
 for(int i=1;i<=a;i++)
 for(int j=1;j<=b;j++)
 if(map[i][j]!=-1)
 for(int k=1;k<=8;k++)
 {
 if(map[i+u[k]][j+w[k]]==-1)
 map[i][j]++;
 }
 for(int i=1;i<=a;i++)
 {
 for(int j=1;j<=b;j++)
 {
 if(map[i][j]!=-1)cout<<map[i][j];
 else cout<<"*";
 }
 cout<<endl;
 }
 return 0;
 }
 
 -----------哭泣的分割线--------------------编译成功 
 测试数据 #0: Accepted, time = 15 ms, mem = 616 KiB, score = 10
 测试数据 #1: Accepted, time = 15 ms, mem = 616 KiB, score = 10
 测试数据 #2: Accepted, time = 0 ms, mem = 616 KiB, score = 10
 测试数据 #3: Accepted, time = 15 ms, mem = 620 KiB, score = 10
 测试数据 #4: Accepted, time = 0 ms, mem = 620 KiB, score = 10
 测试数据 #5: Accepted, time = 0 ms, mem = 612 KiB, score = 10
 测试数据 #6: Accepted, time = 15 ms, mem = 616 KiB, score = 10
 测试数据 #7: Accepted, time = 15 ms, mem = 616 KiB, score = 10
 测试数据 #8: Accepted, time = 0 ms, mem = 616 KiB, score = 10
 测试数据 #9: Accepted, time = 15 ms, mem = 612 KiB, score = 10
 Accepted, time = 90 ms, mem = 620 KiB, score = 100
 代码
 ```c++#include<cstdio> 
 #include<iostream>
 #include<cstring>
 using namespace std;
 int u[9]={-10,0,1,0,-1,1,1,-1,-1},w[9]={-10,1,0,-1,0,1,-1,1,-1};
 int main(void)
 {
 int a,b;
 cin>>a>>b;
 char maps[105][105];
 for(int i=1;i<=a;i++)
 for(int j=1;j<=b;j++)
 cin>>maps[i][j];
 int map[105][105];
 memset(map,0,sizeof(map));
 for(int i=1;i<=a;i++)
 for(int j=1;j<=b;j++)
 if(maps[i][j]=='*')map[i][j]=-1;
 for(int i=1;i<=a;i++)
 for(int j=1;j<=b;j++)
 if(map[i][j]!=-1)
 for(int k=1;k<=8;k++)
 {
 if(map[i+u[k]][j+w[k]]==-1)
 map[i][j]++;
 }
 for(int i=1;i<=a;i++)
 {
 for(int j=1;j<=b;j++)
 {
 if(map[i][j]!=-1)cout<<map[i][j];
 else cout<<"*";
 }
 cout<<endl;
 }
 return 0;
 }
 ```