题目地址:http://codeforces.com/contest/984/problem/B

题目大意:扫雷游戏,给你一个n*m的地图,如果有炸弹,旁边的八个位置都会+1,问这幅图是不是正确的。

题解:把输入的地图转换为数字格式,自己重新按炸弹绘制一幅图,对比一下。

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
const int inf = 0x3f3f3f3f;
int main()
{
int n, m;
int map[][], co[][] = {};
scanf("%d%d", &n, &m);
for (int i = ; i < n; i++)
{
getchar();
for (int j = ; j < m; j++)
{
char cell;
scanf("%c", &cell);
if (cell == '*')
{
map[i][j] = ;
co[i][j] = ;
co[i - ][j - ]++; co[i - ][j]++; co[i - ][j + ]++;
co[i][j - ]++; co[i][j + ]++;
co[i + ][j - ]++; co[i + ][j]++; co[i + ][j + ]++;
}
else if (cell == '.')
map[i][j] = ;
else
map[i][j] = cell - '';
}
}
int flag = ;
for (int i = ; i < n; i++)
{
for (int j = ; j < m; j++)
{
if (map[i][j] != co[i][j]&&co[i][j]<=)
{
flag = ;
goto x;
}
}
}
x:
if (flag == )
printf("NO\n");
else
printf("YES\n");
return ;
}

Codeforces Round #483 (Div. 2) B. Minesweeper的更多相关文章

  1. Codeforces Round #483 (Div. 2) B题

    B. Minesweeper time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  2. Codeforces Round #483 (Div. 2) [Thanks, Botan Investments and Victor Shaburov!]

    题目链接:http://codeforces.com/contest/984 A. Game time limit per test:2 seconds memory limit per test:5 ...

  3. Codeforces Round #483 (Div. 2)题解

    A. Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  4. Codeforces Round #483 (Div. 2)C题

    C. Finite or not? time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  5. Codeforces Round #483 (Div. 2) C. Finite or not?

    C. Finite or not? time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  6. Codeforces Round #483 (Div. 2) D. XOR-pyramid

    D. XOR-pyramid time limit per test 2 seconds memory limit per test 512 megabytes input standard inpu ...

  7. Codeforces Round #483 (Div. 2)

    题目链接: https://cn.vjudge.net/contest/229761 A题: n个数字,两个人轮流去数字,直到剩下最后一个数字为止,第一个人希望剩下的数字最小,第二个人希望数字最大,最 ...

  8. Codeforces Round #483 Div. 1

    A:首先将p和q约分.容易发现相当于要求存在k满足bk mod q=0,也即b包含q的所有质因子.当然不能直接分解质因数,考虑每次给q除掉gcd(b,q),若能将q除至1则说明合法.但这个辣鸡题卡常, ...

  9. 【递推】Codeforces Round #483 (Div. 2) [Thanks, Botan Investments and Victor Shaburov!] D. XOR-pyramid

    题意:定义,对于a数组的一个子区间[l,r],f[l,r]定义为对该子区间执行f操作的值.显然,有f[l,r]=f[l,r-1] xor f[l+1,r].又定义ans[l,r]为满足l<=i& ...

随机推荐

  1. Spark Streaming消费Kafka Direct保存offset到Redis,实现数据零丢失和exactly once

    一.概述 上次写这篇文章文章的时候,Spark还是1.x,kafka还是0.8x版本,转眼间spark到了2.x,kafka也到了2.x,存储offset的方式也发生了改变,笔者根据上篇文章和网上文章 ...

  2. maven私服nexus上传第三方jar包以及下载

    私服是一个特殊的远程仓库,它是架设在局域网内的仓库服务.私服代理广域网上的远程仓库,供局域网内的Maven用户使用.当Maven需要下载构建的使用,它先从私服请求,如果私服上没有的话,则从外部的远程仓 ...

  3. 记录一下我做Udacity 的Data Scientist Nano Degree Project

    做项目的时候看了别人的blog,决定自己也随手记录下在做项目中遇到的好的小知识点. 最近在做Udacity的Data Scientist Nano Degree Project的Customer_Se ...

  4. Java - 自动配置log4j的日志文件路径

    目录 1 日志路径带来的痛点 2 log4j.properties文件的配置 3 彻底解决痛点 3.1 单独的Java程序包 (非Java Web项目) 3.2 Web项目 4 附录 - 获取当前项目 ...

  5. 恐怖的Hibernate和JavaFX Table CallBack!

    目录 [隐藏] 1 Hibernate 2 JavaFX Table Hibernate 最近在做 JavaFX 应用,不管再怎么避免数据持久化,但面对几十万的数据量的时候也只能乖乖的去配置持久层框架 ...

  6. npm 一些有用的提示和技巧

    生成 package.json 我们通常执行 npm init,然后开始添加 npm 请求的信息. 但是,如果我们不关心所有这些信息,并且希望保留默认值,那么对于 npm 请求的每一条数据,我们都按 ...

  7. 如何创建Github创库

    重点:利用Markdown语言写简单的日常使用的文本 基础写作和语法格式 本篇文章的内容来源于Github的基础写作帮助.如果在观看时有什么问题,可以直接查阅源文件.另外需要说明的是Git对Markd ...

  8. 微信小程序的视图与渲染

    1.组件的基本使用 <button type="default" > default </button> <button type="pri ...

  9. 11、增强型for循环对二维数组的输出(test8.java)

    由于笔者原因,这部分知识,尚不能整理出代码,笔者会好好学习增强型for循环中迭代起的相关知识,在笔者有能力,书写好这段代码后,将对本篇文章,进行二次修改,也同时欢迎大家与笔者交流,共同学习,共同进步. ...

  10. powerdesign进军(三)--mysql驱动配置

    目录 资源下载 powerdesign配置 总结 第二节我们已经安装了oracle的驱动,但是企业中还有一个重头数据库(mysql),今天来安装mysql驱动.mysql相较oracle比较简单. 资 ...