codeforces croc2016 A. Amity Assessment (暴力)

题目链接 题意:2×2的格子,有三个位置分别放”A“ "B" "C" ,一个位置为空。只有和空位相邻位置上的字母能移动到空位。没有其他移动规则。现在给出两个状态。问能否互相转化。 思路: 貌似可以dfs...?但是一共才2*2,可以直接暴力枚举。 手写一种变换最多能有12种。

/* ***********************************************
Author :111qqz
Created Time :2016年03月19日 星期六 00时21分02秒
File Name :code/cf/croc2016/A.cpp
************************************************ */
 1#include <cstdio>
 2#include <cstring>
 3#include <iostream>
 4#include <algorithm>
 5#include <vector>
 6#include <queue>
 7#include <set>
 8#include <map>
 9#include <string>
10#include <cmath>
11#include <cstdlib>
12#include <ctime>
13#define fst first
14#define sec second
15#define lson l,m,rt<<1
16#define rson m+1,r,rt<<1|1
17#define ms(a,x) memset(a,x,sizeof(a))
18typedef long long LL;
19#define pi pair < int ,int >
20#define MP make_pair
 1using namespace std;
 2const double eps = 1E-8;
 3const int dx4[4]={1,0,0,-1};
 4const int dy4[4]={0,-1,1,0};
 5const int inf = 0x3f3f3f3f;
 6string a,b,c,d;
 7int kind (string a,string b)
 8{
 9    if (a=="AB") return 1;
10    if (a=="BC") return 1;
11    if (a=="CA") return 1;
12    if (b=="AC") return 1;
13    if  (b=="BA") return 1;
14    if (b=="CB") return 1;
 1    return 2;
 2}
 3int main()
 4{
 5	#ifndef  ONLINE_JUDGE 
 6	freopen("code/in.txt","r",stdin);
 7  #endif
 8	cin>>a>>b>>c>>d;
 9	int p = kind(a,b);
10	int q = kind(c,d);
11	if (p==q)
12	{
13	    puts("YES");
14	}
15	else
16	{
17	    puts("NO");
18	}
1  #ifndef ONLINE_JUDGE  
2  fclose(stdin);
3  #endif
4    return 0;
5}