Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define sz(a) int((a).size())
  4. #define tr(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
  5. #define all(c) (c).begin(),(c).end()
  6. #define uniq(c) sort(all((c))); (c).resize(unique(all((c))) - (c).begin())
  7. #define lobo(c, x) (int) (lower_bound(all((c)), (x)) - (c).begin())
  8. #define upbo(c, x) (int) (upper_bound(all((c)), (x)) - (c).begin())
  9. #define R(i,a,b) for (int i=a; i<=b; i++)
  10. #define stop getchar();
  11. #define tess puts("===========");
  12. #define tes(a) cerr<< #a << " = "<< a <<endl;
  13. #define cincout ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  14.  
  15. #define INF 1000111222
  16. #define EPS 1e-9
  17. #define pb  push_back
  18. #define mp  make_pair
  19.  
  20. #define fi  first
  21. #define se  second
  22. #define X   first
  23. #define Y   second
  24.  
  25. using namespace std;
  26.  
  27. typedef long long int64;
  28.  
  29.  
  30. using namespace std;
  31.  
  32. int T;
  33.  
  34. bool cukup(int l,int b,int L,int B) {
  35.     if (b > B) {
  36.         return (b-B)*2+l <= L;
  37.     }  
  38.     else {
  39.         return l <= L+B-b;
  40.     }
  41. }
  42.  
  43. int main () {
  44.     cin >> T;
  45.     while (T--) {
  46.         int l,b;
  47.         cin >> l >> b;
  48.         int ans = 1;
  49.         int L = 2, B = 2;
  50.  
  51.         while (!cukup(l,b,L,B)) {
  52.             ans++;
  53.             L += 1;
  54.             B += 2;
  55.         }
  56.  
  57.         cout << ans << endl;
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement