题目链接:Codeforces 462A Appleman and Easy Task
题目大意:给定一个图,判断每个位置的周围存在的'o'是否为偶数个。
解题思路:水题,遍历一遍即可。
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 105;
const int dir[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int N;
char g[maxn][maxn];
int check (int x, int y) {
int ret = 0;
for (int i = 0; i < 4; i++) {
int p = x + dir[i][0];
int q = y + dir[i][1];
if (p < 0 || p >= N || q < 0 || q >= N)
continue;
if (g[p][q] == 'x')
continue;
ret++;
}
return ret;
}
bool judge () {
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++)
if (check(i, j) & 1)
return false;
}
return true;
}
int main () {
scanf("%d", &N);
for (int i = 0; i < N; i++)
scanf("%s", g[i]);
printf("%s\n", judge() ? "YES" : "NO");
return 0;
}
分享到:
相关推荐
Codeforces 题库 101-200 共~500题 codeforces.com版权所有。 程序可提交至该网站评测。
Codeforces 题库 001-100 共~500题 codeforces.com版权所有。 程序可提交至该网站评测。
lucifer1004大佬的博客cf上分攻略故里大佬的githubcf思维题刷题数:44- (1421)codeforces 676 div2 A,B done
Codeforces 题库 201-294 共~500题 codeforces.com版权所有。 程序可提交至该网站评测。
codeforces算法比赛题:1295A题
python-for-codeforces一些使用python刷codeforces题的源码
codeforces编程网站预测分数插件
leetcode卡 Problemlist 2020.4.2更新:偶然发现luogu有题单功能了 ...目前只打算做easy和medium中的大部分题目(有些恶心的模拟和锁题不写),偶尔看到拍个板子就能过的hard题也会顺手过一下 模板
使用于Google Chrome的Codeforces Enhancer 1.1.2插件安装包。 版本:codeforces enhancer 1.1.2 使用浏览器:Google Chrome
暴枚最长桌脚的长度$l$,然后长度比$l$长的桌脚全部都要砍掉长度比$l$短的桌脚选择代价前$k$小的砍掉用线段树维护;示例程序 :typedef long l
Codeforces 185A - Plant 全测试点49个
Codeforces 1105B - Zuhair and Strings 测试点37个(全)
这个道题单独来看是不难,变成交互题就难了,对于交互题不理解的可以参考这篇博客:点击这里 操作就是一个删除叶子节点的过程。 AC代码: const int N = 1010; int n; int u, v, x; set g[N]; int ans[N]; int main...
codeforces 19 E Fairy 一道比较难的题目的解题报告 推荐阅读
Codeforces global round 10 codes
Codeforces round 678 division 2 codes
Some of the Codeforces problems codes
codeforces每日一题。 题意: 给出一个数组,让你挑选出能组成任意pair差值为2的幂的序列,并且使这个序列长度尽可能大。 思路: 针对于挑选出来的序列,任意pair对的差值为2的幂数。 假设有多个pair对,设dis(a,b)=2...
Codeforces round 678 D2_Codeforces_源码
一个Codeforces、牛客竞赛、AtCoder平台的编程竞赛查询插件,ACMer必备.zip