Wednesday, December 16, 2015

UVa 11388 - GCD LCM

// 
#include <iostream>
using namespace std;

int main() {
	int c;
	for (cin >> c; c; c--) {
		int g, l;
		cin >> g >> l;
		if (l % g != 0)
			cout << -1 << endl;
		else
			cout << g << " " << l << endl;
	}
}

No comments:

Post a Comment