题目地址: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. ubuntu中设置python默认版本

    看/usr/bin中的Python文件,发现该文件是python2.7的链接文件 于是直接删掉这个软链接,然后重新创建python2.6的链接文件: 1 rm /usr/bin/python 2 ln ...

  2. jboss6.1安装配置

     Jboss6.1的用途,配置,使用详解 一..简介: JBoss是全世界开发者共同努力的成果,一个基于J2EE的开放源代码的应用服务器因为JBoss代码遵循LGPL许可,你可以在任何商业应用中免费使 ...

  3. 派胜OA二次开发笔记(1)重写主界面

    最近从派胜OA 2018 升级到 2019,为了二次开发方便,索性花了两天,反向分析 PaiOA 2019 主界面程序,重写大部分代码,方便对菜单权限进行控制. 主界面/core/index.aspx ...

  4. codeforces1088D_Ehab and another another xor problem交互题

    传送门 一道考验思维的交互题 大致思路就是从最高的二进制位向下询问 代入例子比如: 5 6 6 5 7 4 6 4 讨论一下 交互题的重点学会推理和归纳 #include <bits/stdc+ ...

  5. JavaScript&jQuery学习笔记

    前端JavaScript学习 JavaScript导入方式:1.外部文件导入<script src="myScript.js"></script> 2.在标 ...

  6. 【JDK】JDK源码分析-CyclicBarrier

    概述 CyclicBarrier 是并发包中的一个工具类,它的典型应用场景为:几个线程执行完任务后,执行另一个线程(回调函数,可选),然后继续下一轮,如此往复. 打个通俗的比方,可以把 CyclicB ...

  7. 【0728 | 预习】第三篇 Python基础

    第三篇 Python基础预习 Part 1 变量 一.什么是变量? 二.为什么要有变量? 三.定义变量 四.变量的组成 五.变量名的命名规范 六.变量名的两种风格 Part 2 常量 Part 3 P ...

  8. 链表:如何实现LRU缓存淘汰算法?

    缓存淘汰策略: FIFO:先入先出策略 LFU:最少使用策略 LRU:最近最少使用策略   链表的数据结构: 可以看到,数组需要连续的内存空间,当内存空间充足但不连续时,也会申请失败触发GC,链表则可 ...

  9. Hive安装与部署

    进去root权限(su) 1.从https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-1.2.2/apache-hive-1.2.2-bin.ta ...

  10. (二十三)c#Winform自定义控件-等待窗体

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...