【题目链接】:http://codeforces.com/contest/777/problem/A

【题意】

奇数次操作交换1,2位置的东西;

偶数此操作交换2,3位置的东西

给你操作的次数,和最后的位置;

问你一开始的位置在哪里.

【题解】

/*
一开始在0位置
1 2 3 4 5 6
1 2 2 1 0 0
这就是一个循环,到了第6次操作又回到了初始状态;
n%6 == 1 - > 1
== 2 ->2
...
== 0 ->0
->最终的位置就和n%6的值有关;
在1位置
1 2 3 4 5 6
0 0 1 2 2 1
第6次操作就回到了初始状态; 在2位置
1 2 3 4 5 6
2 1 0 0 1 2
第6次操作回到初始状态 枚举一开始的位置就好;看看哪个和答案符合;
*/

【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%lld",&x) typedef pair<int, int> pii;
typedef pair<LL, LL> pll; const int dx[9] = { 0,1,-1,0,0,-1,-1,1,1 };
const int dy[9] = { 0,0,0,-1,1,-1,1,-1,1 };
const double pi = acos(-1.0);
const int N = 110; int zero[7] = { -1,1 ,2, 2, 1 ,0 ,0 };
int one[7] = { -1,0, 0, 1, 2, 2, 1 };
int two[7] = { -1,2, 1, 0, 0, 1, 2 }; LL n;
int x; int main()
{
//freopen("F:\\rush.txt", "r", stdin);
rel(n);
rei(x);
LL temp = n % 6;
if (temp == 0)
temp = 6;
if (zero[temp] == x)
{
puts("0");
return 0;
}
if (one[temp] == x)
{
puts("1");
return 0;
}
if (two[temp] == x)
{
puts("2");
return 0;
}
return 0;
}

【codeforces 777A】Shell Game的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  3. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  4. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  5. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  6. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

  7. 【Codeforces 429D】 Tricky Function

    [题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...

  8. 【Codeforces 670C】 Cinema

    [题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...

  9. 【codeforces 515D】Drazil and Tiles

    [题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...

随机推荐

  1. 有关Canvas的一点小事—图像绘制

    1.  使用canvas绘制图像 什么是图像?在js中它就是一个<img src=””>,<img>有两种接收图像信息的方法,一个是直接链接到图像地址,一个使用base64数据 ...

  2. axios封装http请求

    import axios from 'axios' const HTTP_TIMEOUT = 15000; export function httpPost(url, params = {},head ...

  3. 《社交红利》读书总结--如何从微信微博QQ空间等社交网络带走海量用户、流量与收入

    <社交红利--如何从微信微博QQ空间等社交网络带走海量用户.流量与收入>--徐志斌 著 <社交红利>这本书2013年9月才上市,卖的非常火. 我最初是在公司内部的期刊上,看到有 ...

  4. 【例题 7-9 UVA-1601】The Morning after Halloween

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 对于没有出现的,当成0节点就好. 所以总是认为有3个人需要走到各自的终点. 将平面图转成点边图.这样比较好枚举. (二维变成一维,模 ...

  5. OpenWrt配置绿联的usb转Ethernet网口驱动

    这个选择kernel modules中的kmod-usb-net-asix 须要加入网络设备接口.相似建立一个vlan,配置下防火墙之类的.

  6. maven插件介绍之tomcat7-maven-plugin

    tomcat7-maven-plugin插件的pom.xml依赖为: <dependency> <groupId>org.apache.tomcat.maven</gro ...

  7. js进阶 13 jquery动画函数有哪些

    js进阶 13 jquery动画函数有哪些 一.总结 一句话总结: 二.jquery动画函数有哪些 原生JavaScript编写动画效果代码比较复杂,而且还需要考虑兼容性.通过jQuery,我们使用简 ...

  8. LaTeX indicator function(指示函数)(\mathbb {1} 不起作用)

    问题说明: \mathbb字符的空心化显示仅对字符有效,对数字无效. 解决方法: 使用 bbm 包 \documentclass{article} \usepackage{bbm} \begin{do ...

  9. amazeui页面分析5

    amazeui页面分析5 一.总结 1.把原模板当成样例集合就好 2.都是一块一块的,删改等操作都方便 3.list方面的操作很多都是ui配合li 4.其实容器本质还是div,所以真的算简单了 5.样 ...

  10. 关于 /etc/zabbix/zabbix_agentd.conf 文件 Hostname 文件的说明

    前提 (1) /etc/hosts 文件如下 [root@testdb ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain loc ...