题意,思路看这个:
https://blog.csdn.net/qq_45323960/article/details/115559004
判断过程用了gcd
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+15;
typedef long long ll;
ll gcd(ll a,ll b)
{
if(b==0)
return a;
return gcd(b,a%b);
}
int main()
{
ll t,n,k;
cin>>t;
while(t--)
{
scanf("%lld%lld",&n,&k);
while(gcd(n,k)!=1)
{
n=n/gcd(n,k);
}
if(n==1)
printf("HUMAN");
else
printf("ROBOT");
printf("\n");
}
return 0;
}