Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
纯属瞎蒙//============================================================================ // Name : 123.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <stdio.h> #include <cstdlib> #include <vector> #include <string> #include <map> #include <set> #include <queue> #include <stack> #include <algorithm> #include <iomanip> #include <sstream> #include <fstream> #include <cstring> using namespace std; int getAns(int m, int n){ if(m<=2) return 1; int k = 1; while(k < m) k*=2; k/=2; n = n%k; if(m%2!=0) m++; int aa = getAns(m/2, n/2); if(aa==0) return 0; if(m%4==0 && n%2==1) return 0; return 1; } int main() { int d; cin >> d; while(d--){ int m,n; cin >> n >> m; if(n<m) cout << 0 << endl; else if(m==0&& n==0) cout << 1 << endl; else if(m==0 ||n==0) cout << 0 << endl; else{ n = n-m; cout << getAns(m,n) << endl; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator