贪心/数学 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet
/*
贪心/数学:还以为是BFS,其实x1 + 4 * k = x2, y1 + 4 * l = y2
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std; const int MAXN = ;
const int INF = 0x3f3f3f3f;
char s[MAXN][MAXN]; int main(void) //Codeforces Round #212 (Div. 2) A. Two Semiknights Meet
{
int t; scanf ("%d", &t);
while (t--)
{
char ch; int x1, y1, x2, y2; bool ok = false; for (int i=; i<=; ++i) scanf ("%s", s[i] + );
for (int i=; i<=; ++i)
{
for (int j=; j<=; ++j)
{
if (!ok && s[i][j] == 'K') {x1 = i; y1 = j; ok = true;}
if (ok && s[i][j] == 'K') {x2 = i; y2 = j;}
}
} if ((x2 - x1) % == && (y2 - y1) % == ) puts ("YES");
else puts ("NO");
} return ;
}
贪心/数学 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet的更多相关文章
- 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts
题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...
- 贪心+构造 Codeforces Round #277 (Div. 2) C. Palindrome Transformation
题目传送门 /* 贪心+构造:因为是对称的,可以全都左一半考虑,过程很简单,但是能想到就很难了 */ /************************************************ ...
- 数学 Codeforces Round #219 (Div. 2) B. Making Sequences is Fun
题目传送门 /* 数学:这题一直WA在13组上,看了数据才知道是计算cost时超long long了 另外不足一个区间的直接计算个数就可以了 */ #include <cstdio> #i ...
- 数学 Codeforces Round #308 (Div. 2) B. Vanya and Books
题目传送门 /* 水题:求总数字个数,开long long竟然莫名其妙WA了几次,也没改啥又对了:) */ #include <cstdio> #include <iostream& ...
- 【DFS】【贪心】Codeforces Round #411 (Div. 1) C. Ice cream coloring
对那个树进行dfs,在动态维护那个当前的冰激凌集合的时候,显然某种冰激凌仅会进出集合各一次(因为在树上形成连通块). 于是显然可以对当前的冰激凌集合贪心染色.暴力去维护即可.具体实现看代码.map不必 ...
- 【贪心】Codeforces Round #407 (Div. 2) A. Anastasia and pebbles
贪心地一个一个尽可能往口袋里放,容易发现和顺序无关. #include<cstdio> #include<iostream> using namespace std; type ...
- 数学 Codeforces Round #282 (Div. 2) B. Modular Equations
题目传送门 题意:a % x == b,求符合条件的x有几个 数学:等式转换为:a == nx + b,那么设k = nx = a - b,易得k的约数(>b)的都符合条件,比如a=25 b=1 ...
- Codeforces Round #212 (Div. 2) D. Fools and Foolproof Roads 并查集+优先队列
D. Fools and Foolproof Roads You must have heard all about the Foolland on your Geography lessons. ...
- 数学 Codeforces Round #291 (Div. 2) B. Han Solo and Lazer Gun
题目传送门 /* 水题,就是用三点共线的式子来判断射击次数 */ #include <cstdio> #include <cmath> #include <string& ...
随机推荐
- Data obtained from ping: is it round trip or one way?
I have 2 servers, each in two separate locations. I need to host an application on one, and the data ...
- vue 自定义 移动端筛选条件
1.创建组件 components/FilterBar/FilterBar.vue <template> <div class="filterbar" :styl ...
- cmake使用演示样例与整理总结
本文代码托管于github cmake_demo cmake中一些提前定义变量 PROJECT_SOURCE_DIR project的根文件夹 PROJECT_BINARY_DIR 执行cmake命 ...
- [办公应用]从美国带回来的兄弟牌brother打印机如何处理
周末帮朋友去调一台国外带回来的brother一体机,型号MFC-J630W.这是她单位老板从国外带回来的,说是便宜:不过她说只有英文说明书,她不太会操作.我想这还不容易么,就满口答应下来了.我先到br ...
- windows 目录空格
Window下安装Scala出现:此时不应有 \scala\bin\..\lib\jline-2.14.5.jar 原因很简单,scala默认安装到了Program Files (x86)文件夹下,目 ...
- linux 多个文件中查找字符串 hadoop 3 安装 调试
http://www.cnblogs.com/iLoveMyD/p/4281534.html 2015年2月9日 14:36:38 # find <directory> -type f - ...
- mysql15--垂直分表水平分表
分表技术(表的结构不能变) 分表技术有(水平分割和垂直分割) 当一张越来越大时候,即使添加索引还慢的话,我们可以使用分表 以qq用户表来具体的说明一下分表的操作. 思路如图 : 首先我创建三张表 u ...
- Ubuntu 12.10安装vmware-tools
1:[菜单]->[虚拟机]->[重新安装vmware tools]出现 图中下边说的很清楚,解压然后执行 2:把压缩包拷贝到 /home/下,然后执行 :tar -zxvf v[按住tab ...
- VS2012变化的快捷键
VS2012变化的快捷键: 注释::VS2010是(Ctrl+E,C),VS2012是(Ctrl+K, Ctrl+C),实际操作,按住Ctrl键不放,先按K键,再按C键.相当于Ctrl+K加 Ctrl ...
- Module in powershell
https://docs.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershell-6 ht ...