Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define sz(a) int((a).size())
- #define tr(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
- #define all(c) (c).begin(),(c).end()
- #define uniq(c) sort(all((c))); (c).resize(unique(all((c))) - (c).begin())
- #define lobo(c, x) (int) (lower_bound(all((c)), (x)) - (c).begin())
- #define upbo(c, x) (int) (upper_bound(all((c)), (x)) - (c).begin())
- #define R(i,a,b) for (int i=a; i<=b; i++)
- #define stop getchar();
- #define tess puts("===========");
- #define tes(a) cerr<< #a << " = "<< a <<endl;
- #define cincout ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
- #define INF 1000111222
- #define EPS 1e-9
- #define pb push_back
- #define mp make_pair
- #define fi first
- #define se second
- #define X first
- #define Y second
- using namespace std;
- typedef long long int64;
- using namespace std;
- int T;
- bool cukup(int l,int b,int L,int B) {
- if (b > B) {
- return (b-B)*2+l <= L;
- }
- else {
- return l <= L+B-b;
- }
- }
- int main () {
- cin >> T;
- while (T--) {
- int l,b;
- cin >> l >> b;
- int ans = 1;
- int L = 2, B = 2;
- while (!cukup(l,b,L,B)) {
- ans++;
- L += 1;
- B += 2;
- }
- cout << ans << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement