Problem Link : https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2383
Solution Idea : http://blog.forthright48.com/2015/08/uva-11388-gcd-lcm.html
Solution :
Solution Idea : http://blog.forthright48.com/2015/08/uva-11388-gcd-lcm.html
Solution :
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll int ca,g,l,a,b;
scanf("%lld",&ca);
while(ca--)
{
scanf("%lld%lld",&g,&l);
if(l%g!=0)
{
printf("-1\n");
}
else
{
a=g;
b=l;
printf("%lld %lld\n",a,b);
}
}
}
No comments:
Post a Comment