http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4108
题意:求斐波那契数列区间[l,r]之和的奇偶性
题解: 规律
1、斐波那契数列奇偶性为 1 1 0 1 1 0 1 1 0 ......;
2、在区间,如果时为奇数,时为偶数;
3、询问一个数的余数=各位数字之和;
4、奇数-奇数=奇数,偶数-偶数=偶数,奇数-偶数=奇数,偶数-奇数=奇数;
5、询问和的奇偶性,不相同则1,相同则0;
/*
*@Author: STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#define endl "\n"
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,p,l,r,u,v;
int ans,cnt,flag,temp,sum;
char a[N],b[N];
char str;
struct node{};
int main()
{
#ifdef DEBUG
freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
#endif
//ios::sync_with_stdio(false);
//cin.tie(0);
//cout.tie(0);
scanf("%d",&t);
while(t--){
//scanf("%d",&n);
cin>>a>>b;
sum=0;
ans=0;
for(int i=0;a[i]!='\0';i++){
sum+=a[i]-'0';
}
for(int i=0;b[i]!='\0';i++){
ans+=b[i]-'0';
}
sum%=3;
sum=(sum+2)%3;
ans%=3;
sum=sum==1;
ans=ans==1;
cout<<(ans!=sum)<<endl;
}
#ifdef DEBUG
printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
//cout << "Hello world!" << endl;
return 0;
}