传送门
思路:打表/手写找规律。
///今天训练赛做的太紧张了,真辣鸡!!!
/**
* From:
* Qingdao Agricultural University
* Created by XiangwangAcmer
* Date : 2019-10-29-18.58.22
* Talk is cheap.Show me your code.
*/
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<cmath>
#include<cctype>
#include<stack>
#include<map>
#include<set>
#include<string>
#include<cstdlib>
#define ll long long
#define ull unsigned long long
#define ios ios::sync_with_stdio(false);
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
using namespace std;
const ll maxn = 1e6 + 5;
const ll minn = 1e9 + 5;
const ll mod = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LIMIT = 4294967295LL;
ll gcd(ll a, ll b)
{
if(b == 0)return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b)
{
return a * b / gcd(a, b);
}
vector<int>v[maxn];
int dp[maxn];
vector<int>G[maxn];
bool row[maxn], col[maxn];
bool flag = 0;
queue<int>q;
set<char>s;
set<set<char> >ss;
ll vis1[maxn], vis2[maxn], vis3[maxn];
int main()
{
ios
int n, m;
cin >> n >> m;
if(m == 2)
{
if(n % 6 == 4 || n % 6 == 5)
cout << 1 << endl;
else if(n % 6 == 1 || n % 6 == 0)
cout << 2 << endl;
else cout << 0 << endl;
}
else if(m == 1)
{
if(n % 3 == 0)
cout << 1 << endl;
else if(n % 3 == 2)
cout << 2 << endl;
else cout << 0 << endl;
}
else if(m == 0)
{
if(n % 6 == 1||n%6 ==2)
cout << 1 <<endl;
else if(n % 6 == 3 || n%6 == 4)
cout << 2 << endl;
else cout << 0 <<endl;
}
return 0;
}