分析:
一开始写数论 挂了 索性打个暴力发现过了(笑
CODE:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define reg register
using namespace std;
typedef long long ll;
ll a,b,ans;
int T;
ll gcd(ll a,ll b){return (!b)?a:gcd(b,a%b);}
int main(){
scanf("%d",&T);
while(T--)
{
ans=0;
scanf("%lld%lld",&a,&b);
ll k=gcd(a,b);
int tot=2,f=1;
while(f)
{
if(gcd(a*tot,b)==k)
ans=a*tot,f=0;
tot++;
}
printf("%lld\n",ans);
}
return 0;
}