#include<iostream>
#include<stdio.h>
#include<algorithm>
#define MAXN 11
using namespace std; char _m[MAXN][MAXN];
char mark[MAXN][MAXN];
int dig[MAXN][MAXN]; int main()
{
//freopen("acm.acm","r",stdin);
int num;
int i;
int j;
int tem;
bool boo;
cin>>num;
boo = false;
for(i = ; i < num; ++ i)
{
for(j = ; j < num; ++ j)
{
cin>>_m[i][j];
}
}
for(i = ; i < num; ++ i)
{
for(j = ; j < num; ++ j)
{
cin>>mark[i][j];
}
}
for(i = ; i < num; ++ i)
{
for(j = ; j < num; ++ j)
{
tem = ;
if(mark[i][j] == 'x')
{
if(i > )
{
if(_m[i-][j] == '*')
++ tem;
}
if(i < num-)
{
if(_m[i+][j] == '*')
++ tem;
}
if(j > )
{
if(_m[i][j-] =='*')
++ tem;
}
if(j < num-)
{
if(_m[i][j+] == '*')
++ tem;
}
if(i > && j > )
{
if(_m[i-][j-] == '*')
++ tem;
}
if(i > &&j < num-)
{
if(_m[i-][j+] == '*')
++ tem;
}
if(i < num-&&j > )
{
if(_m[i+][j-] == '*')
++ tem;
}
if(i < num-&&j < num-)
{
if(_m[i+][j+] == '*')
++ tem;
}
dig[i][j] = tem;
if(_m[i][j] == '*')
boo = true;
}
}
}
for(i = ; i < num; ++ i)
{
for(j = ; j < num; ++ j)
{
if(boo && _m[i][j] == '*')
cout<<_m[i][j];
else if(mark[i][j] == '.')
cout<<mark[i][j];
else
cout<<dig[i][j];
}
cout<<endl;
}
}

POJ 2612的更多相关文章

  1. poj 2612 Mine Sweeper

    Mine Sweeper Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6429   Accepted: 2500 Desc ...

  2. HDU 2612 (BFS搜索+多终点)

    题目链接: http://poj.org/problem?id=1947 题目大意:两人选择图中一个kfc约会.问两人到达时间之和的最小值. 解题思路: 对于一个KFC,两人的BFS目标必须一致. 于 ...

  3. poj 1265 Area 面积+多边形内点数

    Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5861   Accepted: 2612 Description ...

  4. poj和hdu部分基础算法分类及难度排序

    最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...

  5. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  6. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  7. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  8. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  9. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

随机推荐

  1. A-论文一些好的句子

    Using our techniques, task set transformation is performed by modifying the parameters related to ea ...

  2. 利用url传多个参数

    刚开始接触jsp,比较偏向于用button标签的onclick方法进行页面的跳转.但是关于页面跳转的各种问题真是叫人头大,以下记录,仅仅为自己以后查看. Qone 用url传参的时候遇到中文怎么办 编 ...

  3. HDU-3608 最长回文

    HDU-3608 最长回文 题面 Problem Description 给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如ab ...

  4. Group精确定位(canvas定位)

    ## <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> &l ...

  5. Python 错误和异常小结[转]

    原文链接    http://blog.csdn.net/sinchb/article/details/8392827 事先说明哦,这不是一篇关于Python异常的全面介绍的文章,这只是在学习Pyth ...

  6. noip2017d2t2

    看数据范围想到状压,我们知道最后是选出一颗生成树,但边权的计算有一些有趣: 我们先选一个点做根:然后就发现边的权和深度有关:那我们按深度dp;即按层dp; dp[i][s]表示前i层选的点集为s,转移 ...

  7. POJ3723--Conscription(MST)WRONG

    Description Windy has a country, and he wants to build an army to protect his country. He has picked ...

  8. 【python3+request】python3+requests接口自动化测试框架实例详解教程

    转自:https://my.oschina.net/u/3041656/blog/820023 [python3+request]python3+requests接口自动化测试框架实例详解教程 前段时 ...

  9. http基本概念

  10. Android-HttpClient-Get与Post请求登录功能

    HttpClient 是org.apache.http.* 包中的: 第一种方式使用httpclient-*.jar (需要在网上去下载httpclient-*.jar包) 把httpclient-4 ...