Advertisement
jakaria_hossain

codechef - chef wars- return of the jedi

Aug 10th, 2020
1,239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define fast() (ios_base::sync_with_stdio(0),cin.tie(NULL));
  5. int main()
  6. {
  7.     fast();
  8.     int t;
  9.     cin>>t;
  10.     while(t--)
  11.     {
  12.         int h,p;
  13.         cin>>h>>p;
  14.         while(p>0)
  15.         {
  16.             h-=p;
  17.             if(h<=0)break;
  18.             p/=2;
  19.  
  20.         }
  21.         if(p>0)cout<<"1"<<endl;
  22.         else cout<<"0"<<endl;
  23.     }
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement