贪心/数学 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet
2015-06-06 17:24
441 查看
题目传送门
/* 贪心/数学:还以为是BFS,其实x1 + 4 * k = x2, y1 + 4 * l = y2 */ #include <cstdio> #include <algorithm> #include <cstring> using namespace std; const int MAXN = 11; 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=1; i<=8; ++i) scanf ("%s", s[i] + 1); for (int i=1; i<=8; ++i) { for (int j=1; j<=8; ++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) % 4 == 0 && (y2 - y1) % 4 == 0) puts ("YES"); else puts ("NO"); } return 0; }
相关文章推荐
- text
- seo优化如何写出高质量的文章
- 【Android UI】SlidingTabLayout使用小结
- poj2255Tree Recovery
- Javascript的RegExp对象(转载自网络)
- Android Fragment嵌套使用问题总结
- 如何动态迁移虚拟机存储
- 如何写一封优雅的英文邮件
- xml 转义特殊字符 如&'"(转载)
- nginx
- C Primer Plus 第三章
- shell脚本(二)
- 项目
- Linux各个目录的作用
- 聚类算法实践(1)——层次、K-means聚类
- bind query.c
- 《编程珠玑》阅读小记(3) — 数据决定数据结构
- 如何避免测试人员提交重复的Bug
- 如何高效快捷检索得到核心文献?
- Linux常用网络工具:路由扫描之mtr