题目连接:Codeforce 445A DZY Loves Chessboard
题目大意:给出一张n*m的图,要在'.'的位置上填B或者W,给出要求B不能和B相邻,W不能和W相邻,输出方案。
解题思路:对于'.'的位置,横纵坐标和为奇数的放B,偶数的放W。
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 100;
int n, m;
char s[maxn+5][maxn+5];
int main () {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++)
scanf("%s", s[i]);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++)
if (s[i][j] == '.') {
printf("%c", (i+j)%2 ? 'W' : 'B');
} else
printf("%c", s[i][j]);
printf("\n");
}
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编程网站预测分数插件
python-for-codeforces一些使用python刷codeforces题的源码
使用于Google Chrome的Codeforces Enhancer 1.1.2插件安装包。 版本:codeforces enhancer 1.1.2 使用浏览器:Google Chrome
codeforces算法比赛题:1295A题
Codeforces 185A - Plant 全测试点49个
codeforces 19 E Fairy 一道比较难的题目的解题报告 推荐阅读
Codeforces global round 10 codes
Codeforces round 678 division 2 codes
Some of the Codeforces problems codes
Codeforces round 678 D2_Codeforces_源码
使用 C# + WPF 开发 ...你只需要提前构造好某些题的叉点数据,填入它,OK!一切就是这么的方便! 注:仅适用于 Edu 以及 Div.3 轮比赛赛后 hack,不支持 Div.1/2 赛时 hack。 适用人群:想进入首页 Hack 榜的选手
一个Codeforces、牛客竞赛、AtCoder平台的编程竞赛查询插件,ACMer必备.zip
打codeforces的神器
codeforces-js Codeforces JS
2020.4.2更新:偶然发现luogu有题单功能了 更好的阅读体验 Problems Math Greedy DP : : : Graph 最短路: 分层最短路: 并查集: 带权并查集: 二分图: 最小生成树: Tree 单调栈: 单调队列: 树链剖分: with...
Codeforces Round #723 (Div. 2).md