#include<iostream>
#include<cmath>
using namespace std;
int main(){
int b[5][5],c[5][5];
for(int i=0; i<5; i++)
for(int j=0; j<5; j++)
b[i][j]=c[i][j]=0;
for(int i=0,j,k; i<3;){
j=rand();
j%=5;
k=rand();
k%=5;
if(b[j][k])
continue;
else{
b[j][k]=1;
i++;
}
}
for(int i=0; i<5; i++)
for(int j=0; j<5; j++){
if(i-1<0 && j-1<0)
c[i][j]=b[i][j+1]+b[i+1][j]+b[i+1][j+1];
else if(i-1<0 && j+1>4)
c[i][j]=b[i][j-1]+b[i+1][j-1]+b[i+1][j];
else if(i+1>4 && j-1<0)
c[i][j]=b[i-1][j]+b[i-1][j+1]+b[i][j+1];
else if(i+1>4 && j+1>4)
c[i][j]=b[i-1][j-1]+b[i-1][j]+b[i][j-1];
else if(i-1<0)
c[i][j]=b[i][j-1]+b[i][j+1]+b[i+1][j-1]+b[i+1][j]+b[i+1][j+1];
else if(j-1<0)
c[i][j]=b[i-1][j]+b[i-1][j+1]+b[i][j+1]+b[i+1][j]+b[i+1][j+1];
else if(i+1>4)
c[i][j]=b[i-1][j-1]+b[i-1][j]+b[i-1][j+1]+b[i][j-1]+b[i][j+1];
else if(j+1>4)
c[i][j]=b[i-1][j-1]+b[i-1][j]+b[i][j-1]+b[i+1][j-1]+b[i+1][j];
else
c[i][j]=b[i-1][j-1]+b[i-1][j]+b[i-1][j+1]+b[i][j-1]+b[i][j+1]+b[i+1][j-1]+b[i+1][j]+b[i+1][j+1];
}
for(int i=0; i<5; i++){
if(i) cout<<endl;
for(int j=0; j<5; j++){
if(b[i][j]){
cout<<"*";
continue;
}
if(!c[i][j]) cout<<"@";
else cout<<c[i][j];
}
}
}
/*自己看看,要输入什么的自己解决,不过这里有个BUG,那个伪随机数每次好象都是同一个,数据大点应该就好了。*/