mirror of
https://github.com/tiennm99/codechef.git
synced 2026-06-11 00:13:03 +00:00
[Add] solved solutions
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
unsigned long long int gcd(int a, int b) {
|
||||
unsigned long long int temp;
|
||||
while (b != 0)
|
||||
{
|
||||
temp = a % b;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned long long int t, a, b, l, g;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
{
|
||||
cin >> a >> b;
|
||||
g = gcd(a, b);
|
||||
l = a*b/g;
|
||||
cout << g << " " << l << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user