Practice Make Perfect!

11388 gcd lcm

Posted by: dzikrina on: October 23, 2010

//http://uva.onlinejudge.org/external/113/11388.html
//http://github.com/andmej/acm/tree/master/11388%20-%20GCD%20LCM

//11388 PROBLEM d: gcd lcm
#include

using namespace std;

int main()
{
int t;
unsigned int g, l;

cin >> t;
while (t--)
{
cin >> g >> l;
if ( g > l || l % g != 0)
cout << "-1" << endl;
else
cout << g << " " << l << endl;

}

//system ("pause");
return 0;
}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.