CodeForces-12A-Super Agent

Description

There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they have been preparing special agent Pearlo for many years. When, finally, Pearlo learned all secrets of espionage, he penetrated into the Potatoland territory and reached the secret base.

Now he is standing at the entrance, but to get inside he need to pass combination lock. Minute ago one of the workers entered the password on the terminal and opened the door. The terminal is a square digital keyboard 3 × 3 with digits from 1 to 9.

Pearlo knows that the password consists from distinct digits and is probably symmetric with respect to the central button of the terminal. He has heat sensor which allowed him to detect the digits which the worker pressed. Now he wants to check whether the password entered by the worker is symmetric with respect to the central button of the terminal. This fact can Help Pearlo to reduce the number of different possible password combinations.

Input

Input contains the matrix of three rows of three symbols each. Symbol «X» means that the corresponding button was pressed, and «.» means that is was not pressed. The matrix may contain no «X», also it may contain no «.».

Output

Print YES if the password is symmetric with respect to the central button of the terminal and NO otherwise.

Sample Input
Input

XX.

.XX

Output

YES

Input

X.X
X..

Output

NO

水题
判断对称

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;

int main()
{
    char s[4][4];
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            scanf("%c",&s[i][j]);
        }
       // printf("1\n");
        getchar();
    }
    if(s[0][0]==s[2][2]&&s[0][1]==s[2][1]&&s[0][2]==s[2][0]&&s[1][0]==s[1][2])
    {
        printf("YES\n");
        return 0;
    }
    printf("NO\n");
    return 0;
}
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Ypopstar/article/details/51549687
个人分类: Codeforces 模拟 水题
上一篇hdoj-1753-大明A+B
下一篇CodeForces-12B-Correct Solution
想对作者说点什么? 我来说一句

Agent及Multi-Agent系统

2010年04月13日 561KB 下载

Agent模型简介(ppt转的pdf)

2010年10月26日 166KB 下载

软件agent技术

2011年10月26日 13.15MB 下载

重点大学Agent课件

2012年04月10日 2.82MB 下载

Agent开发文档 开发Agent

2009年12月17日 699KB 下载

没有更多推荐了,返回首页

关闭
关闭