893A Chess For Three

思路:

直接模拟即可,第一盘永远是A与B开始

代码:

#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i=(a); i<(b); ++i)
#define _rep(i,a,b) for(int i=(a); i<=(b); ++i)
int n,num,a[4];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n;
_rep(i,1,3) a[i]=i;
_rep(i,1,n) {
cin>>num;
if(a[1]!=num&&a[2]!=num) {
cout<<"NO"<<endl;
return 0;
}
if(a[1]==num) {
swap(a[2],a[3]);
} else {
swap(a[1],a[3]);
}
}
cout<<"YES"<<endl;
return 0;
}

codeforces 893A Chess For Three 模拟的更多相关文章

  1. CodeForces.158A Next Round (水模拟)

    CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include &l ...

  2. Codeforces 893A:Chess For Three(模拟)

    题目链接:http://codeforces.com/problemset/problem/893/A 题意 Alex,Bob,Carl三人下棋,每次只能两个人进行下棋,要求输的那个人当旁观者,然后给 ...

  3. Codeforces 747C:Servers(模拟)

    http://codeforces.com/problemset/problem/747/C 题意:有n台机器,q个操作.每次操作从ti时间开始,需要ki台机器,花费di的时间.每次选择机器从小到大开 ...

  4. Codeforces 740A. Alyona and copybooks 模拟

    A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: st ...

  5. Codeforces 716A Crazy Computer 【模拟】 (Codeforces Round #372 (Div. 2))

    A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  6. CodeForces 670 A. Holidays(模拟)

    Description On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Ma ...

  7. Codeforces 280D k-Maximum Subsequence Sum [模拟费用流,线段树]

    洛谷 Codeforces bzoj1,bzoj2 这可真是一道n倍经验题呢-- 思路 我首先想到了DP,然后矩阵,然后线段树,然后T飞-- 搜了题解之后发现是模拟费用流. 直接维护选k个子段时的最优 ...

  8. Codeforces 1090B - LaTeX Expert - [字符串模拟][2018-2019 Russia Open High School Programming Contest Problem B]

    题目链接:https://codeforces.com/contest/1090/problem/B Examplesstandard input The most famous characters ...

  9. CodeForces - 586C Gennady the Dentist 模拟(数学建模的感觉)

    http://codeforces.com/problemset/problem/586/C 题意:1~n个孩子排成一排看病.有这么一个模型:孩子听到前面的哭声自信心就会减弱:第i个孩子看病时会发出v ...

随机推荐

  1. LeetCode 245. Shortest Word Distance III (最短单词距离之三) $

    This is a follow up of Shortest Word Distance. The only difference is now word1 could be the same as ...

  2. sql语句如何查询一个表中某两个字段的相同数据?

    Select Name,ID From A group by Name,ID having count (*)>1

  3. Android 6.0运行时权限

    一.Runtime Permissions Android 6.0在手机安全方面做的一个处理就是增加了运行时权限(Runtime Permissions). 新的权限机制更好的保护了用户的隐私,Goo ...

  4. Spring-SpringMVC-Mybatis整合的步骤

    1.导入jar包 1.1  spring面向切面jar包 com.springsource.net.sf.cglib-2.2.0.jar com.springsource.org.aopallianc ...

  5. ES6新特性之Symbol使用细节

    在迭代器章节的时候出现过[Symbol.iterator ]的属性,那么到底Symbo到底是什么? 答:Symbol是ES6新定义的一种值,它既不是字符串,也不是对象,而是为javaScript增加的 ...

  6. Muduo阅读笔记---入门(一)

    第一步:下载源码和文档 下载muduo项目的源码.<muduo-manual.pdf>文档,以及<Linux多线程服务端编程:使用muduo C++网络库.pdf>,这些是前期 ...

  7. 蓝桥杯-算法训练--ALGO-5 最短路

    问题描述 给定一个n个顶点,m条边的有向图(其中某些边权可能为负,但保证没有负环).请你计算从1号点到其他点的最短路(顶点从1到n编号). 输入格式 第一行两个整数n, m. 接下来的m行,每行有三个 ...

  8. DOM遍历 - 后代

    jQuery children() 方法 children() 方法返回被选元素的所有直接子元素. 该方法只会向下一级对 DOM 树进行遍历. 您也可以使用可选参数来过滤对子元素的搜索. 下面的例子返 ...

  9. touchmove Bug 工作遇到

    touchmove在安卓浏览器上只会触发一次,需要preventDefault() touchmove events in Android web browsers have a really ser ...

  10. Git Submodules are not SVN Externals

    一直在寻找Git跟TFS里面类似SVN Externals的替代方案, 今天终于找到了GIT里面的替代方案,在此做个备注 http://alexking.org/blog/2012/03/05/git ...