CodeForces 645A Amity Assessment

简单模拟。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-6;
void File()
{
    freopen("D:\in.txt","r",stdin);
    freopen("D:\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
    char c=getchar(); x=0;
    while(!isdigit(c)) c=getchar();
    while(isdigit(c)) {x=x*10+c-'0'; c=getchar();}
}

char s[5][5],t[5][5];

bool check()
{
    if(s[0][0]!=t[0][0]) return 0;
    if(s[0][1]!=t[0][1]) return 0;
    if(s[1][0]!=t[1][0]) return 0;
    if(s[1][1]!=t[1][1]) return 0;
    return 1;
}

void f()
{
    if(s[0][0]=='X') { swap(s[0][0],s[1][0]); return; }
    if(s[1][0]=='X') { swap(s[1][1],s[1][0]); return; }
    if(s[1][1]=='X') { swap(s[0][1],s[1][1]); return; }
    if(s[0][1]=='X') { swap(s[0][1],s[0][0]); return; }
}

int main()
{
    scanf("%s",s[0]);
    scanf("%s",s[1]);
    scanf("%s",t[0]);
    scanf("%s",t[1]);

    for(int i=1;i<=200;i++)
    {
        if(check()) { printf("YES
"); return 0; }
        f();
    }

    printf("NO
");
    return 0;
}
原文地址:https://www.cnblogs.com/zufezzt/p/5916018.html