题目:https://codeforces.com/contest/1260/problem/C
思路:裴蜀定理:\(a*x+b*y=c\) 仅当 \(gcd(a,b)\mid{c}\) 时,等式成立
设 \(b>r\)
当 \(y*b\) 被染为蓝色,最近的 \(x*r\) 离 \(y*b\) 的距离 \(c_{min}=gcd(b,r)\)
根据题意:\(x*r+(k-1)*r\ge y*b+b\longrightarrow y*b+gcd(b,r)+(k-1)*r\ge y*b+b\)
所以 \(gcd(b,r)+(k-1)*r-b\ge 0\)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{
return b?gcd(b,a%b):a;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int T;cin>>T;
while(T--)
{
ll r,b,k;
cin>>r>>b>>k;
if(r>b) swap(r,b);
if(gcd(b,r)+(k-1)*r>=b) cout<<"OBEY"<<endl;
else cout<<"REBEL"<<endl;
}
return 0;
}