#define _USE_MATH_DEFINES #pragma region include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //// //#include // #pragma endregion //#include ///////// #pragma region typedef typedef long long LL; typedef long double LD; typedef unsigned long long ULL; #pragma endregion //typedef ////定数 const int INF = (int)1e9; const LL MOD = (LL)1e9+7; const LL LINF = (LL)4e18+20; const LD PI = acos(-1.0); const double EPS = 1e-9; ///////// using namespace::std; /* 531424756029718528 531424756029718580 531424756029718580 531424756029718528 */ bool check(pair& dat){ if(dat.first==0 && dat.second==0 ){ cout << "Yes" << endl; return true; } return false; } void solve(){ LL A,B; queue > que; set > memo; cin>>A>>B; pair tmp,dat,next; tmp.first = A; tmp.second = B; que.push(tmp); while(que.size()){ dat= que.front(); que.pop(); if(dat.first%2 == 0 ){ next.first = dat.first/2; next.second = dat.second-1; if(next.second>=0){ if( check(next) ){ return; } if( memo.count(next) == 0 ){ que.push( next ); memo.insert(next); } } } if(dat.second%2 == 0 ){ next.first = dat.first-1; next.second = dat.second/2; if( next.first>=0 ){ if( check(next) ){ return; } if( memo.count(next) == 0 ){ que.push( next ); memo.insert(next); } } } } cout << "No" << endl; } #pragma region main signed main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;//小数を10進数表示 cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別 solve(); } #pragma endregion //main()