Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define int long long
- using namespace std;
- int gcd(int a, int b) {
- int res = 1;
- if (!a) return b;
- if (!b) return a;
- while (!(a % 2) && !(b % 2))
- { res *= 2; b /= 2; a /= 2; }
- while (!(a % 2))
- a /= 2;
- while (!(b % 2))
- b /= 2;
- if (a > b) {int t = a; a = b; b = t;}
- return res * gcd(a, b - a);}
- int32_t main() {
- int t; cin >> t;
- while (t--) {
- int r, b, k; cin >> r >> b >> k;
- if (r > b) { int t = r; r = b; b = t;}
- if ((b - 1 - gcd(b, r)) / r + 1 >= k)
- cout << "REBEL\n";
- else
- cout << "OBEY\n"; }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement