アイデア:、法律を見つけ、最初のテーブルを打つ、法令のタイトルを見つけることは非常に簡単見つけることになり、3サイクルごとに、奇数と偶数奇数が、偉大なトピックのデータを直接文字列配列で、に多数のモジュロ演算を書きます。しかし、最初の用語mを算出する奇数または偶数であり、その後、最初のn個のアイテムを計算する前に、再度、区間[M、N]が与えられる対象は奇数であるか偶数、少しスキル、奇数ある - 偶数=偶数、奇数 - 偶数奇数=は、偶数 - 奇数=奇数 - 偶数偶数偶数=。
#include<iostream>
#include<stdio.h>
#include<string>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<stack>
#include<set>
#include<vector>
using namespace std;
int a[10000];
//int fib(int n)
//{
// if (n <= 1)return n;
// if (a[n] != 0)return a[n];
// return a[n] = fib(n - 1) + fib(n - 2);
//}
int xxx(string str, int mod)
{
int ans = 0;
unsigned int i;
for (i = 0; i<str.length(); i++)
{
//cout << str[i] << " ";
ans = ans * 10 + str[i] - '0';
ans = ans%mod;
}
return ans;
}
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
string s1;
string s2;
cin >> s1>>s2;
int x1 = xxx(s1, 3);
int x2 = xxx(s2, 3);
if (x2 == 0)
{
if (x1 == 0)cout << "0\n";
if (x1 == 1)cout << "0\n";
if (x1 == 2)cout << "1\n";
}
else if (x2 == 2)
{
if (x1 == 0)cout << "0\n";
if (x1 == 1)cout << "0\n";
if (x1 == 2)cout << "1\n";
}
else
{
if (x1 == 0)cout << "1\n";
if (x1 == 1)cout << "1\n";
if (x1 == 2)cout << "0\n";
}
}
return 0;
}