题意:
给出 G, L;
求两个数字最大公约数为G,最小公倍数为L;
多组求最小的;
思路:
因为最大公约数和最小公倍数肯定是倍数;
所以如果G,L不成倍数就误解;
否则答案就是G,L;
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define ll long long
ll G, L;
int main() {
int t;
scanf("%d", &t);
while(t--) {
scanf("%lld%lld", &G, &L);
if (L % G == 0) {
printf("%lld %lld\n", G, L);
continue;
}else
printf("-1\n");
}
return 0;
}