zoukankan      html  css  js  c++  java
  • 贪心/数学 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet

    题目传送门

     1 /*
     2     贪心/数学:还以为是BFS,其实x1 + 4 * k = x2, y1 + 4 * l = y2
     3 */
     4 #include <cstdio>
     5 #include <algorithm>
     6 #include <cstring>
     7 using namespace std;
     8 
     9 const int MAXN = 11;
    10 const int INF = 0x3f3f3f3f;
    11 char s[MAXN][MAXN];
    12 
    13 int main(void)        //Codeforces Round #212 (Div. 2) A. Two Semiknights Meet
    14 {
    15     int t;    scanf ("%d", &t);
    16     while (t--)
    17     {
    18         char ch;    int x1, y1, x2, y2;    bool ok = false;
    19 
    20         for (int i=1; i<=8; ++i)    scanf ("%s", s[i] + 1);
    21         for (int i=1; i<=8; ++i)
    22         {
    23             for (int j=1; j<=8; ++j)
    24             {
    25                 if (!ok && s[i][j] == 'K')    {x1 = i;    y1 = j;    ok = true;}
    26                 if (ok && s[i][j] == 'K')    {x2 = i;    y2 = j;}
    27             }
    28         }
    29 
    30         if ((x2 - x1) % 4 == 0 && (y2 - y1) % 4 == 0)    puts ("YES");
    31         else    puts ("NO");
    32     }
    33 
    34     return 0;
    35 }
    编译人生,运行世界!
  • 相关阅读:
    NOIP模拟测试17
    C++11下的关键字
    Tyvj 1518 CPU监控(线段树)
    单身三连之三
    论求解线性方程
    单身三连之二
    单身三连之一
    20190719总结
    卡常
    论突变为零(不定更新)
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4556959.html
Copyright © 2011-2022 走看看