Codechef Chef Wars - Return of the Jedi Problem Code: CHEFWARS Solution

 #include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin>>t;
  while(t--){
    int h,p;
    cin>>h>>p;
    int c=p;
    while(p){
      p>>=1;
      c+=p;
    }
    if(c>=h)cout<<1;
    else cout<<0;
    cout<<'\n';
  }
  return 0;
}

Comments