submission_id string | problem_id string | status string | code string | input string | output string | problem_description string |
|---|---|---|---|---|---|---|
s897720467 | p00005 | Accepted | def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
def lcm(a,b):
return a*b//gcd(a,b)
while True:
try:
a,b=map(int,input().split())
print(gcd(a,b),lcm(a,b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s708959658 | p00005 | Accepted | while True:
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a%b)
def lcm(a, b):
return a*b/gcd(a, b)
try:
a, b = map(int, input().split())
except EOFError:
break
print(str(gcd(b, a%b)) + " " + str(int(lcm(a, b))))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s906553828 | p00005 | Accepted | while True:
try:
lst = list(map(int, input().split()))
a, b = lst[0], lst[1]
while b != 0:
a, b = b, a % b
c = lst[0]* lst[1]/ a
print('{:.0f}'.format(a), end = " ")
print('{:.0f}'.format(c))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s708741787 | p00005 | Accepted | import math
while True:
try:
a,b=(map(int,input().split()))
x=math.gcd(a,b)
y=a*b//x
print(x,y)
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s208089588 | p00005 | Accepted | import math
john=[]
while True:
try:
john.append(input())
except EOFError:
break
for i in john:
k=list(map(int,i.split()))
print(int(math.gcd(k[0],k[1])),int(k[0]*k[1]/math.gcd(k[0],k[1])))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s781442127 | p00005 | Accepted | import math
import sys
def gcd(a,b):
if b==0:
return a
return gcd(b, a%b)
def lcm(a,b):
return a/gcd(a,b)*b
for l in sys.stdin:
a=list(map(int,l.split()))
print("%d %d"%(gcd(a[0],a[1]),lcm(a[0],a[1])))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s481888515 | p00005 | Accepted | def gcd(a:int, b:int):
if b == 0:
return a
return gcd(b,a%b)
def main():
while 1:
try:
a = list(map(int, input().split()))
b = gcd(a[0],a[1])
c = a[0]/b*a[1]
print('%s %d' % (b,c))
except:
break
if __name__ == "__main__":
main()
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s973611338 | p00005 | Accepted | def gcd(a, b):
if b == 0:
return a
return gcd(b,a%b)
def main():
while 1:
try:
a = list(map(int, input().split()))
b = gcd(a[0],a[1])
c = a[0]/b*a[1]
#d = [b,c]
print('%d %d' % (b,c))
except:
break
main()
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s966428351 | p00005 | Accepted | def GCD(a,b):
if(b==0):
return a
return GCD(b,a%b)
def LCM(a,b):
return a / GCD(a,b) * b
while True:
try:
x = list(map(int,input().split()))
ans_1 = GCD(x[0],x[1])
ans_2 = LCM(x[0],x[1])
print("%d %d"%(ans_1,ans_2))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s504402503 | p00005 | Accepted | def gcd(a,b):
if(b==0):
return a
return gcd(b,a%b)
while True:
try:
a,b = map(int, input().split())
g = gcd(a,b)
print("%s %d"%(g,a/g*b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s150991875 | p00005 | Accepted | #mathモジュールをインポートする
import math
try:
while True:
a,b = map(int,input().split())
#最小公約数
num1 = math.gcd(a,b)
#最大公倍数
num2 = int(a * b / num1)
print(str(num1) + " " + str(num2))
#EOFErrorをひろいコードを終了する
except EOFError:
pass
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s611132349 | p00005 | Accepted | def gcd(m, n):
while n:
m, n = n, m % n
return m
def lcm(m, n):
return m // gcd(m, n) * n
for line in open(0).readlines():
a, b = map(int, line.split())
print(gcd(a, b), lcm(a, b))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s792515919 | p00005 | Accepted | import math
while True:
try:
a, b = map(int, input().split())
print(math.gcd(a, b), int((a * b) / math.gcd(a, b)))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s692669585 | p00005 | Accepted | import math
while True:
try :
a,b = map(int,input().split())
gcd = math.gcd(a,b)
c= a/gcd
d= b/gcd
print(gcd,int(c*d*gcd))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s105697610 | p00005 | Accepted | import sys
import math
def gcd(x,y):
if(x%y==0):
return y
else:
return(gcd(y,x%y))
try:
while True:
a,b= map(int, input().split())
max1=gcd(a,b)
min1=(a*b)//gcd(a,b)
print(str(max1)+' '+str(min1))
except EOFError:
pass
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s496228180 | p00005 | Accepted | import math
while True:
try:
a,b = map(int,input().split())
x = math.gcd(a,b)
y = a * b // x
print(x,y)
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s603801780 | p00005 | Accepted | def gcd(aa, bb):
if aa % bb == 0:
return bb
return gcd(bb, aa % bb)
import sys
for line in sys.stdin.readlines():
ab = list(map(int, line.split()))
a = max(ab)
b = min(ab)
g = gcd(a, b)
print(g, a * b // g)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s094845574 | p00005 | Accepted | def gcd(x,y):
return gcd(y,x % y) if y > 0 else x
def lcm(a, b):
return ((a*b) // gcd(a,b))
while(1):
try:
x,y = (int(x) for x in input().split())
print(gcd(x,y),lcm(x,y))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s072382201 | p00005 | Accepted | import math
while True:
try:
a, b = list(map(int, input().split()))
print('{0} {1}'.format(math.gcd(a, b), int(a * b / math.gcd(a, b))))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s775642961 | p00005 | Accepted | import math
try:
while True:
a, b = list(map(int, input().split()))
print("{} {}".format(math.gcd(a, b), (a * b) // math.gcd(a, b)))
except Exception as _:
pass
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s381103112 | p00005 | Accepted | import math
while True:
try:
a = list(map(int,input().split()))
b = (math.gcd(a[0],a[1]))
c = ((a[0]*a[1])//math.gcd(a[0],a[1]))
print(b,c)
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s995750402 | p00005 | Accepted | import math
try:
while True:
a, b= map(int, input().split())
print(math.gcd(a, b),(a*b)//math.gcd(a,b))
except EOFError:
pass
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s603997992 | p00005 | Accepted | # 最大公約数:ユークリッドの互除法
import sys
def gcd(x, y):
return y if not x%y else gcd(y, x%y)
def get_input():
data = []
for line in sys.stdin:
a, b = [int(i) for i in line.split()]
data.append((a,b))
return data
data = get_input()
for x,y in data:
GCD = gcd(x,y)
LCM = x*y // GCD
print(GCD, LCM)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s447663239 | p00005 | Accepted | import sys
sys.setrecursionlimit(10**7)
import fileinput
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
for line in sys.stdin:
x, y = map(int, line.split())
print(gcd(x,y),lcm(x,y))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s704124462 | p00005 | Accepted | import fileinput
def GCD(x, y):
if y != 0:
return GCD(y, x % y)
else:
return x
for line in fileinput.input():
x, y = [int(s) for s in line.split()]
#print("{} {}".format(GCD(x, y), int(x * y/GCD(x, y))))#別にformatでなくてもいい
print(GCD(x, y),int(x * y/GCD(x, y)))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s498589410 | p00005 | Accepted | import fractions
while True:
try:
a,b = map(int,input().split())
except:
break
print(fractions.gcd(a,b),a*b // fractions.gcd(a,b))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s680831117 | p00005 | Accepted | from math import gcd
while True:
try:
a, b = map(int, input().split())
print(gcd(a, b), a*b//gcd(a, b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s273813341 | p00005 | Accepted | def GCD(a, b):
if b == 0:
return a
return GCD(b, a % b)
def LCM(a, b):
return a * b // GCD(a, b)
import sys
s = sys.stdin.readlines()
n = len(s)
for i in range(n):
x, y = map(int, s[i].split())
print(GCD(x, y), LCM(x, y))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s123233868 | p00005 | Accepted | import math
while 1:
try:
a,b,=map(int,input().split())
print(math.gcd(a,b),a*b//math.gcd(a,b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s841793575 | p00005 | Accepted | import sys;import math;print("\n".join(["{} {}".format(math.gcd(a,b), a // math.gcd(a,b) * b) for x in sys.stdin for a, b in [[int(y) for y in x.split()]] ]))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s208190190 | p00005 | Accepted | import math
while True:
try:
a, b = [int(x) for x in input().split()]
print(math.gcd(a,b), a*b // math.gcd(a,b))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s138814992 | p00005 | Accepted | import math
while 1:
try:
a, b = map(int, input().split())
g = math.gcd(a, b)
print(g, int(a*b/g))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s687148219 | p00005 | Accepted | import math
while True:
try:
a, b = map(int , input().split())
print(math.gcd(a, b), a // math.gcd(a, b) * b)
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s447233164 | p00005 | Accepted | import math
while True:
try:
a,b=list(map(int,input().split()))
print(math.gcd(a,b),a*b//math.gcd(a,b))
except:break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s320299434 | p00005 | Accepted | while True:
try:
( a, b ) = map ( int, input ( ).split ( ) )
except EOFError: break
( x, y ) = ( a, b )
while x != 0:
( x, y ) = ( y % x, x )
print ( "%s %s" % ( y, a * b // y ) )
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s258870122 | p00005 | Accepted | import math
while True:
try:
a,b = map(int,input().split())
print(math.gcd(a,b),a*b//math.gcd(a,b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s323134862 | p00005 | Accepted | import math
while True:
try:
a,b = map(int,input().split())
print(math.gcd(a,b),a*b//math.gcd(a,b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s249273390 | p00005 | Accepted | def lcm(a,b):
return a//gcd(a,b)*b
def gcd(a,b):
while b != 0:
r=a%b
a=b
b=r
return a
while True:
try:
a=list(map(int,input().split()))
print(gcd(a[0],a[1]),lcm(a[0],a[1]))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s890243849 | p00005 | Accepted | def lcm(a, b):
return a // gcd(a, b) * b
def gcd(a, b):
while b != 0:
r = a % b
a = b
b = r
return a
while True:
try:
a = list(map(int, input().split()))
print(gcd(a[0], a[1]), lcm(a[0], a[1]))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s581718966 | p00005 | Accepted | # AOJ 0005 GCD and LCM
# Python3 2018.6.9 bal4u
def lcm(a, b):
return a // gcd(a, b) * b
def gcd(a, b):
while b != 0:
r = a % b
a = b
b = r
return a
while True:
try:
a = list(map(int, input().split()))
print(gcd(a[0], a[1]), lcm(a[0], a[1]))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s402569826 | p00005 | Accepted | while(True):
try:
(a, b) = map(int, input().split(" "))
(x, y) = (a, b)
while (x != 0):
(x, y) = (y%x, x)
print("%s %s" %(y, a*b//y))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s944382251 | p00005 | Accepted | import math
try:
while(True):
a, b = map(int, input().split())
print(math.gcd(a, b), a * b // math.gcd(a, b))
except:
pass
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s759002531 | p00005 | Accepted | import fractions
while 1:
try:
a,b=map(int,input().split())
c=fractions.gcd(a,b)
print(c,(a*b)//c)
except:break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s668924151 | p00005 | Accepted | def lcm(a, b):
return a // gcd(a, b) * b
def gcd(a, b):
while b != 0:
r = a % b
a = b
b = r
return a
while True:
try:
a = list(map(int, input().split()))
print(gcd(a[0], a[1]), lcm(a[0], a[1]))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s020764248 | p00005 | Accepted | def gcd(a, b):
while b:
a, b = b, a % b
return a
while True:
try:
a,b = map(int,input().split())
print (gcd(a,b),a *b // gcd(a,b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s733218065 | p00005 | Accepted | import math
while True :
try :
a, b = map(int, input().split())
Gcd = math.gcd(a, b)
Lcm = (a * b) // Gcd
print(Gcd, Lcm)
except :
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s407315505 | p00005 | Accepted | def lcm(a, b):
return a // gcd(a, b) * b
def gcd(a, b):
while b != 0:
r = a % b
a = b
b = r
return a
while True:
try:
a = list(map(int, input().split()))
print(gcd(a[0], a[1]), lcm(a[0], a[1]))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s861640367 | p00005 | Accepted | def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
def lcm(a,b):
return (a*b)//gcd(a,b)
while True:
try:
a,b=map(int,input().split())
except:
break
print(gcd(a,b),lcm(a,b))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s413173167 | p00005 | Accepted | import math
while True:
try:
a,b =map(int,input().split())
c =math.gcd(a,b)
d =a*b// math.gcd(a,b)
print(c,d)
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s051680952 | p00005 | Accepted | import math
while 1 :
try:
a,b=map(int,input().split())
c=math.gcd(a,b)
print(c, (a*b)//c)
except:break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s572817308 | p00005 | Accepted | while True:
try:
a,b=map(int,input().split())
if a<b:
a,b=b,a
s=b
r=a%s
while True:
if r==0:
G=s
break
else:
s,r=r,s%r
L=int((a*b)/G)
print(G,L)
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s659859904 | p00005 | Accepted | import math
import sys
for line in sys.stdin.readlines():
a, b = list(map(int, line.split()))
print(f'{math.gcd(a,b)} {a*b//math.gcd(a,b)}')
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s351463665 | p00005 | Accepted | import math
import sys
if __name__ == '__main__':
for line in sys.stdin:
a,b = map(int,line.split())
print(math.gcd(a,b),(a*b) // math.gcd(a,b))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s887935434 | p00005 | Accepted | import math
while True:
try:
a,b=map(int,input().split())
def lcm(x,y):
return (x*y)//math.gcd(x,y)
print(math.gcd(a,b),lcm(a,b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s380461319 | p00005 | Accepted | def solve(a, b):
if a % b == 0:
return b
else:
return solve(b, a % b)
while True:
try:
a, b = map(int, input().split())
lcm = solve(a,b)
print(lcm, a * b // lcm)
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s239868919 | p00005 | Accepted | def gcd(x, y):
while y != 0:
x, y = y, x % y
return x
def lcm(x, y):
return x//gcd(x, y)*y
while True:
try:
a, b = map(int, input().split())
print(gcd(a, b), lcm(a, b))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s905318674 | p00005 | Accepted | ###
### atcorder test program
###
import sys
### math class
class math:
### pi
pi = 3.14159265358979323846264338
### GCD
def gcd(self, a, b):
if b == 0:
return a
return self.gcd(b, a%b)
### LCM
def lcm(self, a, b):
return (a*b)//self.gcd(a,b)
math = math()
### output class
class output:
### list
def list(self, l):
l = list(l)
print(" ", end="")
for i, num in enumerate(l):
print(num, end="")
if i != len(l)-1:
print(" ", end="")
print()
output = output()
### input sample
#i = input()
#A, B, C = [x for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
# a, b = map(int, line.split())
### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")
for line in sys.stdin.readlines():
x, y = [int(temp) for temp in line.split()]
print("{} {}".format(math.gcd(x,y), math.lcm(x,y)))
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s198120407 | p00005 | Accepted | import math
while True:
try:
x, y = map(int, input().split())
print(str(math.gcd(x,y)) + " " + str((x * y) // math.gcd(x, y)))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s330484998 | p00005 | Accepted | import sys
def euclid(x, y):
if y == 0: return x
elif x < y: return euclid(y, x)
else: return euclid(y, x%y)
for line in sys.stdin:
a, b = map(int, line.split())
gcd = euclid(a, b)
lcm = a*b/gcd
print str(gcd)+' '+str(lcm)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s980017434 | p00005 | Accepted | import math
while True:
try:
a,b=map(int,input().split())
gcd=math.gcd(a,b)
lcm=int(a*b/gcd)
print(gcd, lcm)
except:break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s306727527 | p00005 | Accepted | import math
while True:
try:
a,b=list(map(int,input().split()))
x=math.gcd(a,b)
y=int(a*b/x)
print("%d %d"%(x,y))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s291187945 | p00005 | Accepted | while True:
try:
m,n = map(int, input().split())
except EOFError:
break
LCM = m * n
if m < n:
m,n = n,m
# calculating GCD
while True:
if m % n == 0:
GCD = n
break
else:
m, n = n, m % n
# calculating LCM
LCM = LCM // GCD
print(GCD,LCM)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s662861194 | p00005 | Accepted | def GCD(x, y):
# 最大公約数
if x < y:
x, y = y, x
while True:
r = x % y
if r == 0:
return y
x, y = y, r
def calc_DCD_LCM(x, y):
# 最大公約数
gcd = GCD(x, y)
# 最小公倍数
lcm = int(x*y/gcd)
return(gcd, lcm)
while True:
try:
x, y = list(map(int, input().split()))
gcd, lcm = calc_DCD_LCM(x, y)
print('{0} {1}'.format(gcd, lcm))
except:
exit(0)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s971730318 | p00005 | Accepted | def GCD(a,b):
S=[a,b]
S.sort(reverse=True)
while S[1]>0:
S2=[S[1],S[0]%S[1]]
S=S2
return S[0]
try:
while True:
a,b=[int(i) for i in input().split(" ")]
G=GCD(a,b)
L=int(a*b/G)
print("%d %d"%(G,L))
except EOFError:
pass
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s550670417 | p00005 | Accepted | import math
while True:
try:
a, b = map(int, input().split())
print(math.gcd(a, b), a * b // math.gcd(a, b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s527071363 | p00005 | Accepted | import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
if __name__ == '__main__':
while True:
try:
a, b = map(int, input().split())
print('{0} {1}'.format(math.gcd(a, b), lcm(a, b)))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s669811975 | p00005 | Accepted | def gcd(x,y):
while y:
x, y = y, x % y
return x
def lcm(x,y):
return x * y // gcd(x,y)
while True:
try:
a = list(map(int,input().split()))
print(gcd(a[0],a[1]),lcm(a[0],a[1]))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s702837226 | p00005 | Accepted | while True:
try:
n=list(map(int, input().split()))#ファイルの読み込み --.py <--.txt
except EOFError:
break
if n[0]>n[1]:#なくてもいいなあ
l=n[0]
s=n[1]
else:
l=n[1]
s=n[0]
a=l
b=s
r=a%b
while r!=0:
a=b
b=r
r=a%b
GCD=int(b)
LCM=int(l*s/b)
print(GCD, LCM)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s744438032 | p00005 | Accepted | def GCD(a, b):
while b!=0:
tmp=b
b=a%b
a=tmp
return a
while True:
try:
a, b = map(int, input().split())
except EOFError:
break
a, b = (a, b) if a>=b else (b, a)
gcd=GCD(a,b)
print(gcd, a*b//gcd)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s307057652 | p00005 | Accepted | import sys
def findGCD(a, b):
if b == 0:
return a
return findGCD(b, a%b)
if __name__ == "__main__":
for line in sys.stdin:
a, b = [int(i) for i in line.strip().split(" ")]
GCD = findGCD(a,b)
LCM = a*b//GCD
print(GCD, LCM)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s368623859 | p00005 | Accepted | import sys
import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
for line in sys.stdin:
a, b = [int(x) for x in line.split()]
c = math.gcd(a, b)
d = lcm(a, b)
print("%d %d" % (c, d) )
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s902363486 | p00005 | Accepted | while True:
try:
a, b = [int(x) for x in input().split()]
n, m = [min(a, b), max(a, b)]
while n != 0:
n, m = m % n, n
print(m, a * b // m)
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s469559638 | p00005 | Accepted | while(1):
try:
a, b = map(int, input().split())
except:
break
x = max(a, b)
y = min(a, b)
if x % y == 0:
gcd = y
else:
while x % y != 0:
z = x % y
x = y
y = z
else:
gcd = z
lcm = a * b // gcd
print(gcd, lcm)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s013241943 | p00005 | Accepted | def gcd(x,y):
q = max(x,y) % min(x,y)
if q == 0 :
return min(x,y)
return round(gcd(min(x,y),q))
def lcm(a, b):
return round(a*b / gcd(a, b))
while True:
try:
a, b = map(int,input().split())
print(gcd(a,b),lcm(a,b))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s412391984 | p00005 | Accepted | import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
while True:
try:
a, b = map(int, input().split())
print('{} {}'.format(math.gcd(a, b), lcm(a, b)))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s126346480 | p00005 | Accepted | while True:
try:
a,b = map(int, input().split())
nlist = sorted([a,b])
while True:
c = nlist[1]%nlist[0]
nlist = [c, nlist[0]]
if (c == 0):
break
ss = nlist[1]
print(ss, int(a*b/ss))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s579849822 | p00005 | Accepted | import math
while True:
try:
a, b = map(int, input().split(" "))
print(math.gcd(max(a, b), min(a, b)), int(max(a, b) * min(a, b) / math.gcd(max(a, b), min(a, b))))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s051374049 | p00005 | Accepted | import math
while(True):
try:
a,b = map(int, input().split())
c = math.gcd(a,b)
print(c, int(a*b/c))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s452217305 | p00005 | Accepted | # coding:utf-8
import sys
# 最大公約数
def gcd(a, b):
while b > 0:
a, b = b, a%b
return a
# 最小公倍数
def lcm(a, b):
return a*b/gcd(a, b)
for s in sys.stdin:
a, b = map(int,s.split())
gcd_num = gcd(a, b)
lcm_num = lcm(a, b)
print "%d %d"%(gcd_num, lcm_num)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s315427357 | p00005 | Accepted | ans = []
def gcd(a, b) :
if a % b == 0 :
return b
else :
return gcd(b, a % b)
def lcm(a, b) :
return a * b // gcd(a, b)
while True :
try :
s = input()
a, b = map(int, s.split())
m_gcd, m_lcm = gcd(a, b), lcm(a, b)
ans.append([m_gcd, m_lcm])
except :
for a in ans :
print(a[0], a[1])
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s322632596 | p00005 | Accepted | def gcd(x, y):
if x < y:
x, y = y, x
return x if y == 0 else gcd(y, x % y)
def run():
while True:
try:
x, y = map(int, input().split())
g = gcd(x, y)
l = x * y // g
print(g, l)
except:
break
if __name__ == '__main__':
run()
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s450018711 | p00005 | Accepted | from fractions import gcd
while True:
try:
a, b = map(int, input().split())
left = gcd(a,b)
print( left, a*b//(left))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s009127861 | p00005 | Accepted | import sys,math
for e in sys.stdin:
a,b=map(int, e.split())
d=a*b
a = math.gcd(a,b)
print(a, d//a)
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s994526640 | p00005 | Accepted | def gcd(a, b):
if a == 0:
return b
else:
return gcd(b%a, a)
def lcm(a, b):
return a*b//gcd(a, b)
while 1:
try:
a,b = map(int, input().split(" "))
print(gcd(a, b),lcm(a, b))
except:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s676681314 | p00005 | Accepted | def gcd(a,b):
if b < 1: return a
a,b = b,a % b
return gcd(a,b)
ss = input().split()
while ss:
a,b = map(int,ss)
g = gcd(a,b)
l = int(a*b/g)
print(g,l)
try: ss = input().split()
except EOFError: break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s970919693 | p00005 | Accepted | while True:
try:
data = map(int, raw_input().split())
[a, b] = data
m = a
n = b
while m % n != 0:
hoge = m % n
m = n
n = hoge
gcm = n
lcm = a * b / gcm
print gcm, lcm
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s783933809 | p00005 | Runtime Error | #include <stdio.h>
using namespace std;
int gcd(unsigned long num1,unsigned long num2) {
if (num2 == 0) {
return num1;
}return gcd(num2, num1 % num2);
}
int lcm(unsigned long n1, unsigned long n2) {
return n1 * n2 / gcd(n1, n2);
}
int main() {
unsigned long a, b;
while (~scanf("%d %d",&a,&b)) {
printf("%d %d\n", gcd(a, b),lcm(a,b));
}
}
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s103766530 | p00005 | Runtime Error |
while True:
try:
m,n = map(int,input().split())
if m<n:
a = n
b = m
else:
a = m
b = n
c = a % b
while c != 0:
temp = c
if b % c == 0:
break
c = b % c
b = temp
d = m * n / c
print(str(c) + " " + str(int(d)))
except EOFError:
break
| 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s418959623 | p00005 | Runtime Error | import sys
# 入力が終わるまで読み込む
while 1:
line = sys.stdin.readline()
if (not line):
break
# 2つの変数に読み込み
x, y = map(int, line.split())
# ユークリッドの互除法
if (x > y):
gcd = x
t = y
else :
gcd = y
t = x
while (t > 0) :
tmp = gcd % t
gcd = t
t = tmp
# 最小公倍数を求める A * B = GCD * LCM
lcm = x * y / gcd
print str(gcd) + " " + str(lcm) | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s919635147 | p00005 | Runtime Error | import sys
#最大公約数
def gcd(x, y):
s = x / y
r = x % y
if r == 0:
return y
else:
return gcd(y, r)
#最小公倍数
def lcm(x, y):
return x*y/gcd(x, y)
def main():
#print ("a")
tmp = sys.stdin.readline().split(" ")
#print ("b")
while 1:
a = int(tmp[0])
b = int(tmp[1])
#print ("a="+str(a))
#print ("b="+str(b))
#b = sys.stdin.readline()
#print ("d")
if a > b:
c = a
d = b
else:
c = b
d = a
print (str(gcd(c, d)) + " " + str(int(lcm(c,d))))
tmp = sys.stdin.readline()
if len(tmp) == 1:
break
else:
tmp = tmp.split(" ")
#print ("exit")
if __name__ == "__main__":
main() | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s255505419 | p00005 | Runtime Error | import sys
#最大公約数
def gcd(x, y):
s = x / y
r = x % y
if r == 0:
return y
else:
return gcd(y, r)
#最小公倍数
def lcm(x, y):
return x*y/gcd(x, y)
def main():
#print ("a")
tmp = sys.stdin.readline().split(" ")
#print ("b")
while 1:
a = long(tmp[0])
b = long(tmp[1])
#print ("a="+str(a))
#print ("b="+str(b))
#b = sys.stdin.readline()
#print ("d")
if a > b:
c = a
d = b
else:
c = b
d = a
print (str(gcd(c, d)) + " " + str(long(lcm(c,d))))
tmp = sys.stdin.readline()
if len(tmp) == 1:
break
else:
tmp = tmp.split(" ")
#print ("exit")
if __name__ == "__main__":
main() | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s077958511 | p00005 | Runtime Error | import sys
def main():
tmp = sys.stdin.readline().split(" ")
a = long(tmp[0])
b = long(tmp[1])
print ("Hello World")
if __name__ == "__main__":
main() | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s275245972 | p00005 | Runtime Error | import sys
def main():
tmp = sys.stdin.readline().split(" ")
while 1:
if a > b:
c = a
d = b
else:
c = b
d = a
tmp = sys.stdin.readline()
if len(tmp) == 1:
break
if __name__ == "__main__":
main() | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s176528614 | p00005 | Runtime Error | import sys
def main():
tmp = sys.stdin.readline()
while tmp:
tmp = sys.stdin.readline().split("")
if a > b:
c = a
d = b
else:
c = b
d = a
tmp = sys.stdin.readline()
if __name__ == "__main__":
main() | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s719090957 | p00005 | Runtime Error | import sys
def main():
tmp = sys.stdin.readline()
while tmp:
tmp = sys.stdin.readline().split("")
if a > b:
c = a
d = b
else:
c = b
d = a
tmp = sys.stdin.readline()
break
if __name__ == "__main__":
main() | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s931041114 | p00005 | Runtime Error | import sys
def main():
tmp = sys.stdin.readline()
while tmp:
tmp = sys.stdin.readline().split("")
a = 1
b = 2
if a > b:
c = a
d = b
else:
c = b
d = a
tmp = sys.stdin.readline()
break
if __name__ == "__main__":
main() | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s804546081 | p00005 | Runtime Error | def gcd(a,b):
r = a % b
while r > 0:
a = b
b = r
r = a % b
return b
def lcm(a,b):
return a*b / gcd(a,b)
while True:
try:
a,b = map(int, raw_input().split())
print gcd(a,b) + " " + lcm(a,b)
except EOFError:
break | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s217861763 | p00005 | Runtime Error | #!/usr/bin/env python3
while(True):
try:
a, b=map(int, input().split())
gcd=0
for i in range(a):
if(a%i==0 and b%i==0):
gcd=i
lcm=a*b/gcd
print("{0} {1}".format(gcd, lcm))
except EOFError:
break | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s846568443 | p00005 | Runtime Error | #!/usr/bin/env python3
while(True):
try:
a, b=map(int, input().split())
except EOFError:
break
gcd=0
for i in range(a):
if(a%i==0 and b%i==0):
gcd=i
lcm=a*b/gcd
print("{0} {1}".format(gcd, lcm)) | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
s015027744 | p00005 | Runtime Error | import sys
def main():
for input_line in sys.stdin:
num1 = int(input_line.split(' ')[0])
num2 = int(input_line.split(' ')[1])
if num1 <= num2:
dividend(num1, num2, num1)
elif num1 > num2:
dividend(num1, num2, num2)
result.sort(reverse=True)
greatest_common_divisor = result[0]
least_common_multiple = num1 * num2 / greatest_common_divisor
print('%s %s' % (greatest_common_divisor, least_common_multiple))
def dividend(num1, num2, num):
for i in range(num).sort(reverse=True):
divisor = i+1
if num1 % divisor == 0 and num2 % divisor == 0:
result.append(divisor)
break
if __name__ == '__main__':
result = []
main() | 8 6
50000000 30000000
| 2 24
10000000 150000000
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.