submission_id string | problem_id string | status string | code string | input string | output string | problem_description string |
|---|---|---|---|---|---|---|
s441016784 | p00005 | Wrong Answer | import sys
for line in sys.stdin:
a, b = map(int, line.split())
c = a * b
while b:
a, b = b, a % b
print(str(a) + ' ' + str(c / 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>
|
s384947649 | p00005 | Wrong Answer | def gcd(a,b):
while b:
a,b = b, a%b
return a
def lcm(a,b,gcdnum=0):
if gcdnum==0:
return a*b // gcd(a,b)
else:
return a*b // gcdnum
a,b = map(int,raw_input().split())
print "%d %d"%(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>
|
s523308401 | p00005 | Wrong Answer | #GCD and LCM
while True:
try:
a, b = (int(i) for i in input(). split())
x = a * b
while True:
c = a % b
a = b
b = c
if a % b == 0:
break
x = x / a
print("%d %d" % (b, x))
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>
|
s714350660 | p00005 | Wrong Answer | def gcd(a,b):
while b != 0:
a,b = b,a%b
return a
list = map(int, raw_input().split())
list.sort()
print gcd(list[1],list[0]), list[0]*list[1]/gcd(list[1],list[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>
|
s063486413 | p00005 | Wrong Answer | 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 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>
|
s292792381 | p00005 | Wrong Answer | def get_input():
while True:
try:
yield ''.join(raw_input())
except EOFError:
break
if __name__ == '__main__':
a = list(get_input())
for n in a:
inl=n.split()
num=inl[0]+inl[1]
l=list(num)
time=0
for i in l:
time+=1
print time | 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>
|
s434883798 | p00005 | Wrong Answer | import sys
for l in sys.stdin:
a,b = map(int, l.split())
ab = a*b
while True:
ba,bb = a,b
b = a % b
if b==0:
break
a = ba
print "%d %d" % (bb, ab/bb) | 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>
|
s774256555 | p00005 | Wrong Answer | print "1 2" | 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>
|
s300807584 | p00005 | Wrong Answer | import sys
for l in sys.stdin:
l = l.split()
print " ".join(l)
| 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>
|
s126621674 | p00005 | Wrong Answer | while True:
try:
a,b = map(int, raw_input().split())
ab = a*b
while True:
ba,bb = a,b
b = a % b
if b==0:
break
a = ba
print "%d %d" % (bb, ab/bb)
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>
|
s335452486 | p00005 | Wrong Answer | while True:
try:
a,b = map(int, raw_input().split())
ab = a*b
a, b = (a,b) if a > b else (b,a)
while True:
ba,bb = a,b
b = a % b
if b==0:
break
a = ba
print "%d %d" % (bb, ab/bb)
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>
|
s428885753 | p00005 | Wrong Answer | def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
while True:
try:
a,b=[int(i) for i in 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>
|
s686549811 | p00005 | Wrong Answer | def GCD(x, y):
while x > 0:
z = x
x = y % x
y = z
return y
def LCM(x, y):
X = x / GCD(x, y)
Y = y / GCD(x, y)
return X * Y * GCD(x, y)
import sys
L = sys.stdin.readlines()
for line in L:
x, y = list(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>
|
s225170266 | p00005 | Wrong Answer | def GCD(a, b):
if b > a:
return GCD(b, a)
elif a % b == 0:
return b
return GCD(b, a % b)
def LCM(a, b):
return a * b / GCD(a, b)
import sys
L = sys.stdin.readlines()
for line in L:
x, y = list(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>
|
s207525766 | p00005 | Wrong Answer | def gcd(a, b):
if a == 0 or b == 0:
return 0
while b != 0:
a, b = b, a%b
return a
while True:
try:
a, b = map(int, input().split())
except EOFError:
break
else:
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>
|
s946632196 | p00005 | Wrong Answer | #coding: utf-8
import sys
def gojo(a,b):
print a,b
if b % a == 0:
return a
else:
return gojo(b % a, a)
for line in sys.stdin:
l = map(int,line.split())
l.sort()
a = l[0]
b = l[1]
print gojo(a,b),a*b/gojo(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>
|
s368880044 | p00005 | Wrong Answer | import math
while True:
try:
a,b = map(int,input().split())
gcd = math.gcd(a,b)
lcm = a*b /gcd
print(gcd,int(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>
|
s649660039 | p00005 | Wrong Answer |
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>
|
s137514104 | p00005 | Wrong Answer |
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>
|
s119803593 | p00005 | Wrong Answer | k = list(map(int, input().split()))
a = k[0]
b = k[1]
r = a % b
while r != 0:
a = b
b = r
r = a % b
else:
ans1 = b
a = k[0]
b = k[1]
v = a % b
index = 2
while v != 0:
aa = a * index
v = aa % b
index = index + 1
else:
ans2 = aa
print(ans1, ans2) | 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>
|
s234042924 | p00005 | Wrong Answer | data_set = []
while True:
try:
k = list(map(int, input().split()))
data_set.append(k)
except:
for k in data_set:
a = k[0]
b = k[1]
r = a % b
while r != 0:
a = b
b = r
r = a % b
else:
ans1 = b
a = k[0]
b = k[1]
v = a % b
index = 2
while v != 0:
aa = a * index
v = aa % b
index = index + 1
else:
ans2 = aa
print(ans1, ans2)
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>
|
s017748991 | p00005 | Wrong Answer | a, b = map(int, input().split())
def gcd(a, b):
while b:
a, b = b, a % b
return a
def acd(a, b):
return int(a*b / gcd(a,b))
print(gcd(a,b), acd(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>
|
s666200224 | p00005 | Wrong Answer | def get_gcd(_a, _b):
if _a % _b == 0:
return _b
return get_gcd(_b, _a % _b)
if __name__ == '__main__':
a, b = list(map(int, input().split()))
gcd = get_gcd(a, b)
lcm = a * b / gcd
print(str(gcd) + " " + str(int(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>
|
s854608679 | p00005 | Wrong Answer | import sys
import fractions
lines = []
for line in sys.stdin:
num = line.split(" ")
a, b = int(num[0]), int(num[1])
gcd = fractions.gcd(a, b)
print("{0} {1}".format(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>
|
s860764679 | p00005 | Wrong Answer | a,b=map(int,input().split())
for i in range(1,a+1):
f=(b*i)%a
lcm=(b*i)
if f==0:
break
for j in range(1,a+1):
if a%j==0 and b%j==0 and j*lcm==a*b:
print(j,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>
|
s366987038 | p00005 | Wrong Answer | def main():
import sys
for line in sys.stdin:
a, b = map(int, line.split())
c = a*b
while a % b != 0:
a, b = b, a%b
print(b, c*b)
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>
|
s362173026 | p00005 | Wrong Answer | 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>
|
s222373011 | p00005 | Wrong Answer | import math
try:
a,b=map(int,input().split())
print(math.gcd(a,b),a*b//math.gcd(a,b))
except:
print() | 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>
|
s125294531 | p00005 | Wrong Answer | 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>
|
s868489308 | p00005 | Wrong Answer | 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>
|
s187954275 | p00005 | Wrong Answer | 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>
|
s209625430 | p00005 | Wrong Answer | 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>
|
s000061735 | p00005 | Wrong Answer | import math
try:
while 1:
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>
|
s992286585 | p00005 | Wrong Answer | try:
GCD = 0
LCM = 0
while True:
lists = list(map(int, input().split()))
l = sorted(lists)
num = l[0] * l[1]
while l[0] < l[1]:
GCD = l[1] - l[0]
l[1] = GCD
l = sorted(l)
LCM = int(num / GCD)
print(str(GCD) + " " + str(LCM))
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>
|
s548178905 | p00005 | Wrong Answer | try:
GCD = 0
LCM = 0
while True:
lists = list(map(int, input().split()))
l = sorted(lists)
num = l[0] * l[1]
while l[0] < l[1]:
GCD = l[1] - l[0]
l[1] = GCD
l = sorted(l)
LCM = int(num / GCD)
print(GCD, LCM)
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>
|
s178816792 | p00005 | Wrong Answer | a, b = map(int, input().split())
d = a * b
if a < b:
tmp = a
a = b
b = tmp
c = a % b
while(c != 0):
a = b
b = c
c = a % b
g = b
l = d / g
print(str(g)+" "+str(l)) | 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>
|
s424413130 | p00005 | Wrong Answer | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
while True:
tmpb = b
b = a % b
a = tmpb
if(b == 0):
break
return int(a)
def lcm(a, b):
for i in range(max([a, b]), a*b + 1):
if(i % a == 0 and i % b == 0):
return i
return a*b
for i in sys.stdin:
try:
line = [int(k) for k in i.split(" ")]
g = gcd(max(line), min(line))
print(str(g) + " " + str(line[0]*line[1]/g)) # + str(lcm(line[0], line[1]))
except:
raise
exit() | 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>
|
s937622464 | p00005 | Wrong Answer | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
while True:
tmpb = b
b = a % b
a = tmpb
if(b == 0 or b == 1):
break
return int(a)
def lcm(a, b):
for i in range(max([a, b]), a*b + 1):
if(i % a == 0 and i % b == 0):
return i
return a*b
for i in sys.stdin:
try:
line = [int(k) for k in i.split(" ")]
g = gcd(max(line), min(line))
print(str(g) + " " + str(line[0]*line[1]/g)) # + str(lcm(line[0], line[1]))
except:
raise
exit() | 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>
|
s281348354 | p00005 | Wrong Answer | def gcd(a, b):
if (a % b) == 0:
return b
return gcd(b, a%b)
while True:
try:
nums = list(map(int, input().split()))
print(gcd(nums[0], nums[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>
|
s623817196 | p00005 | Wrong Answer | a,b = map(int, input().split())
if a < b:
a,b = b,a
def gcd(x,y):
while y > 0:
x,y = y,x%y
return x
def lcm(x,y):
return x * y / gcd(x, y)
print(gcd(a,b), 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>
|
s231055442 | p00005 | Wrong Answer | t = 0
while t == 0:
try:
x,y=[int(i) for i in input().split()]
except:
break
else:
a = x * y
if x < y:
x,y =y,x
while y > 0:
r = x % y
x = y
y = r
print(str(x) + " " + str(a/x)) | 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>
|
s023771834 | p00005 | Wrong Answer | t = 0
while t == 0:
try:
x,y=[int(i) for i in input().split()]
except:
break
else:
a = x * y
if x < y:
x,y =y,x
while y > 0:
r = x % y
x = y
y = r
print(str(a/x) + " " + str(x)) | 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>
|
s859391156 | p00005 | Wrong Answer | t = 0
while t == 0:
try:
x,y=[int(i) for i in input().split()]
except:
break
else:
a = x * y
if x < y:
x,y =y,x
while y > 0:
r = x % y
x = y
y = r
print(str(x) + " " + str(a / x)) | 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>
|
s841573749 | p00005 | Wrong Answer | # -*-coding:utf-8
import fileinput
def main():
for line in fileinput.input():
tokens = list(map(int, line.strip().split()))
a, b = tokens[0], tokens[1]
if a < b:
a, b = b, a
ansGCD = GreatestCommonDivisor(a, b)
ansLCM = LeastCommonMultiple(a, b)
print('{0} {1}'.format(ansGCD, ansLCM))
def GreatestCommonDivisor(a, b):
while b:
a, b = b, a%b
return a
def LeastCommonMultiple(a, b):
return (a*b) / GreatestCommonDivisor(a, b)
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>
|
s518684804 | p00005 | Wrong Answer | import fractions as f
a,b=map(float,input().split())
print(f.gcd(a,b))
print(a*b//f.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>
|
s600171558 | p00005 | Wrong Answer | import fractions as f
a,b=map(int,input().split())
print(str(f.gcd(a,b))+' '+str(a*b//f.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>
|
s648904651 | p00005 | Wrong Answer | def gcd(a,b):
if a > b:
x = a
y = b
else:
x = b
y = a
while y > 0:
r = x % y
x = y
y = r
return x
def lcm(a,b,gcd):
return a*b/gcd
while 1:
try:
a,b = [int(x) for x in input().split()]
gcd = gcd(a,b)
lcm = lcm(a,b,gcd)
print('{} {}'.format(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>
|
s128080103 | p00005 | Wrong Answer | def GCD(a,b):
while (a % b) != 0:
a,b = b, a%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:
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>
|
s571471945 | p00005 | Wrong Answer | import sys
for e in sys.stdin:
a, b = map(int, e.split())
p = a * b
while b:
a, b = b, a%b
pass
print (str(a)+' '+str(p/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>
|
s256602798 | p00005 | Wrong Answer | import sys
for e in sys.stdin:
a, b = map(int, e.split())
p = a * b
while b:
a, b = b, a%b
pass
print (a,p/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>
|
s587930266 | p00005 | Wrong Answer | while True:
try:
a,b,c,d,e,f = [int(x) for x in input().split()]
x = (c*e-b*f)/(a*e-b*d)
y = (c*d-a*f)/(b*d-a*e)
print('{:>.3f},{:>.3f}'.format(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>
|
s040568934 | p00005 | Wrong Answer | import math
a, b = map(int, input().split())
# 最小公倍数
def lcm(a, b):
return (a*b) // math.gcd(a ,b)
# 出力
print(math.gcd(a, b))
print(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>
|
s380844637 | p00005 | Wrong Answer | import math
a, b = map(int, input().split())
# 最小公倍数
def lcm(a, b):
return (a*b) // math.gcd(a ,b)
# 出力
print("{} {}".format(math.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>
|
s935785975 | p00005 | Wrong Answer | import math
import sys
for line in sys.stdin.readlines():
a, b = map(int, line.split())
print(a, b)
# 最小公倍数
def lcm(a, b):
return (a*b) // math.gcd(a ,b)
# 出力
print("{} {}".format(math.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>
|
s526845885 | p00005 | Wrong Answer | import math
import sys
while True:
try:
a, b = map(int, input().split())
except EOFError:
break
# 最小公倍数
def lcm(a, b):
return (a*b) // math.gcd(a ,b)
# 出力
print("{} {}".format(math.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>
|
s629107696 | p00005 | Wrong Answer | import math
while 1:
try:
a,b = map(int, input().split())
print(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>
|
s269188498 | p00005 | Wrong Answer | while 1:
try:
a = list(map(int, input().split()))
a.sort()
while a[1]%a[0] != 0:
a[1] %= a[0]
a.sort()
print(a[0])
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>
|
s804681175 | p00005 | Wrong Answer | while 1:
try:
a = list(map(int, input().split()))
a.sort()
while a[1]%a[0] != 0:
a[1] %= a[0]
a.sort()
print(str(a[0]))
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>
|
s782600619 | p00005 | Wrong Answer | # Vol0005.
import sys
def intinput():
a = input().split()
for i in range(len(a)):
a[i] = int(a[i])
return a
def get_gcd(x, y):
if x < y: return get_gcd(y, x)
# x >= yのときはx % yを計算してyとx % yの話にする。
# ここでx % yのところが0ならばyが求める答えとなる。
if y == 0: return x
return get_gcd(y, x % y)
def main():
data = []
lines = sys.stdin.readlines()
for line in lines:
data.append(line.split())
N = len(data)
for i in range(N):
a = int(data[i][0]); b = int(data[i][1])
gcd = get_gcd(a, b)
lcm = (a // gcd) * b
print('%d %d' % (a, b))
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>
|
s989459499 | p00005 | Wrong Answer | def main():
a,b=(int(x) for x in input().split())
a1=a
b1=b
while b!=0:
c=a%b
a=b
b=c
print(a," ",a1*b1/a)
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>
|
s772081438 | p00005 | Wrong Answer | def main():
a,b=(int(x) for x in input().split())
a1=a
b1=b
while b!=0:
c=a%b
a=b
b=c
print(a," ",a1*b1//a)
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>
|
s497567467 | p00005 | Wrong Answer | def main():
a,b=(int(x) for x in input().split())
a1=a
b1=b
while b!=0:
c=a%b
a=b
b=c
print(a,a1*b1//a)
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>
|
s256536651 | p00005 | Wrong Answer | import math
a,b=map(int,input().split())
A,B=map(int,input().split())
def lcm(x,y):
return (x*y)//math.gcd(a,b)
def lcm2(q,w):
return (q*w)//math.gcd(A,B)
print(math.gcd(a,b),lcm(a,b))
print(math.gcd(A,B),lcm2(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>
|
s435052348 | p00005 | Wrong Answer | # 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>
|
s150621659 | p00005 | Wrong Answer | A , B = map(int,raw_input().split())
a , b = A , B
while a != b:
if a < b:
b = b-a
elif b < a:
a = a-b
b = A*B/a
print(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>
|
s526502961 | p00005 | Wrong Answer | A , B = map(int,raw_input().split())
a , b = A , B
while a != b:
if a < b:
b = b-a
elif b < a:
a = a-b
b = A*B/a
print 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>
|
s125159047 | p00005 | Wrong Answer | # -*- coding: utf-8 -*-
import sys
def isprime(n):
for i in xrange(2, int(n ** 0.5)+1 ):
if n % i == 0: return False
return True
outList = []
for line in sys.stdin.readlines():
List = map(int, line.strip().split())
[a, b] = List
# LCM
LCM = 1
for i in xrange(2, max(a, b)):
if isprime(i): continue
if isprime(a) or isprime(b): break
while(a % i == 0 and b % i == 0):
LCM *= i
a /= i
b /= i
# GCD
GCD = List[0] * b
print LCM, 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>
|
s492384503 | p00005 | Wrong Answer | import sys
from decimal import *
def readint():
for line in sys.stdin:
yield map(int,line.split())
def gcd(x,y):
[x,y] = [max(x,y),min(x,y)]
z = x % y
while z > 0:
[x,y,z] = [y,z,x % z]
return y
for [x,y] in readint():
GCD = gcd(x,y)
LCM = Decimal(x)*Decimal(y)/GCD
print "%d %d" % (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>
|
s423338930 | p00005 | Wrong Answer | import sys
def readint():
for line in sys.stdin:
yield map(int,line.split())
def gcd(x,y):
[x,y] = [max(x,y),min(x,y)]
z = x % y
while z > 0:
[x,y,z] = [y,z,x % z]
return y
for [x,y] in readint():
GCD = gcd(x,y)
mx = x/GCD
print GCD,mx*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>
|
s295484478 | p00005 | Wrong Answer | import sys
def readint():
for line in sys.stdin:
yield map(int,line.split())
def gcd(x,y):
[x,y] = [max(x,y),min(x,y)]
z = x % y
while z > 0:
[x,y,z] = [y,z,x % y]
return y
for [x,y] in readint():
GCD = gcd(x,y)
mx = x/GCD
print GCD,mx*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>
|
s811864218 | p00005 | Wrong Answer | import sys
def readint():
for line in sys.stdin:
yield map(int,line.split())
def gcd(x,y):
[x,y] = [max(x,y),min(x,y)]
while 1:
z = x % y
print x,y,z
if z == 0:
break
[x,y,z] = [y,z,x]
return y
for [x,y] in readint():
GCD = gcd(x,y)
mx = x/GCD
print GCD,mx*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>
|
s838272887 | p00005 | Wrong Answer | def digits(n):
if n < 10: return 1
c = 0
while n > 0:
c += 1
n = n // 10
return c
while 1:
try:
inp = input()
except EOFError:
break
else:
n, m = inp.split(' ')
n = int(n)
m = int(m)
print(digits(n + m)) | 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>
|
s981228217 | p00005 | Time Limit Exceeded | import sys
for ab in sys.stdin:
a,b=map(int,ab.split(" "))
if a>=b:
for g in xrange(b,0,-1):
if a%g==0 and b%g==0:
gcd = g
break
for l in xrange(1,b+1):
if (a*l)%b == 0:
lcm = a*l
break
else:
for g in xrange(a,0,-1):
if a%g==0 and b%g==0:
gcd = g
break
for l in xrange(1,a+1):
if (b*l)%a == 0:
lcm = b*l
break
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>
|
s102175111 | p00005 | Time Limit Exceeded | #!/usr/bin/env python3
while(True):
try:
a,b=map(int, input().split())
except EOFError:
break
gcd=1
for i in range(1, a):
if(a%i==0 and b%i==0):
gcd=i
lcm=int(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>
|
s018996616 | p00005 | Time Limit Exceeded | import sys
def gcd(a, b, large):
ret = None
for i in xrange(large, 0, -1):
if i == 0 or i == 1:
continue
if a % i == 0 and b % i == 0:
ret = i
break
return ret
def lcm(a, b):
ret = None
lst = [a, b]
while True:
if a == b:
ret = a
break
if a > b:
b += lst[1]
else:
a += lst[0]
return ret
def main():
for line in sys.stdin.readlines():
a, b = [int(n) for n in line.split()]
if a <= b:
large = b
else:
large = a
g = gcd(a, b, large)
l = lcm(a, b)
print "{0} {1}".format(g, l)
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>
|
s931487442 | p00005 | Time Limit Exceeded | import sys
def gcd(a, b, large):
ret = None
for i in xrange(large, 0, -1):
if i == 0 or i == 1:
continue
if a % i == 0 and b % i == 0:
ret = i
break
return ret
def lcm(a, b):
ret = None
lst = [a, b]
while True:
if a == b:
ret = a
break
if a > b:
b += lst[1]
else:
a += lst[0]
return ret
def main():
for line in sys.stdin.readlines():
a, b = [int(n) for n in line.split()]
if a <= b:
large = b
else:
large = a
print "{0} {1}".format(gcd(a, b, large), lcm(a, b))
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>
|
s744159963 | p00005 | Time Limit Exceeded | import sys
def gcd(a, b):
ret = None
if a <= b:
large = b
else:
large = a
for i in xrange(large, 0, -1):
if i == 0 or i == 1:
continue
if a % i == 0 and b % i == 0:
ret = i
break
return ret
def lcm(a, b):
ret = None
lst = [a, b]
while True:
if a == b:
ret = a
break
if a > b:
b += lst[1]
else:
a += lst[0]
return ret
def main():
for line in sys.stdin.readlines():
a, b = [int(n) for n in line.split()]
print "{0} {1}".format(gcd(a, b), lcm(a, b))
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>
|
s251034892 | p00005 | Time Limit Exceeded | import sys
def gcd(a, b):
ret = None
if a <= b:
large = b
else:
large = a
for i in xrange(large, 0, -1):
if a % i == 0 and b % i == 0:
ret = i
break
return ret
def lcm(a, b):
ret = None
lst = [a, b]
while True:
if a == b:
ret = a
break
if a > b:
b += lst[1]
else:
a += lst[0]
return ret
def main():
for line in sys.stdin.readlines():
a, b = [int(n) for n in line.split()]
print "{0} {1}".format(gcd(a, b), lcm(a, b))
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>
|
s864383829 | p00005 | Time Limit Exceeded | import sys
def gcd(a, b):
r = None
if a > b:
small = a
else:
small = b
for i in xrange(small, 0, -1):
if a % i == 0 and b % i == 0:
r = i
return r
def lcm(a, b):
ret = None
lst = [a, b]
while True:
if a == b:
ret = a
break
if a > b:
b += lst[1]
else:
a += lst[0]
return ret
def main():
for line in sys.stdin.readlines():
a, b = [int(n) for n in line.split()]
print "{0} {1}".format(gcd(a, b), lcm(a, b))
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>
|
s371634932 | p00005 | Time Limit Exceeded | import sys
def gcd(a, b):
ret = None
if a == b:
return a
elif a < b:
large = b
else:
large = a
for i in xrange(large, 0, -1):
if a % i == 0 and b % i == 0:
ret = i
break
return ret
def lcm(a, b):
ret = None
lst = [a, b]
while True:
if a == b:
ret = a
break
if a > b:
b += lst[1]
else:
a += lst[0]
return ret
def main():
for line in sys.stdin.readlines():
a, b = [int(n) for n in line.split()]
print "{0} {1}".format(gcd(a, b), lcm(a, b))
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>
|
s762453465 | p00005 | Time Limit Exceeded | import sys
def gcd(a, b):
ret = None
if a > b:
s = b
else:
s = a
for i in xrange(s, 0, -1):
if a % i == 0 and b % i == 0:
ret = i
break
return ret
def lcm(a, b):
ret = None
lst = [a, b]
while True:
if a == b:
ret = a
break
if a > b:
b += lst[1]
else:
a += lst[0]
return ret
def main():
for line in sys.stdin.readlines():
a, b = [int(n) for n in line.split()]
print "{0} {1}".format(gcd(a, b), lcm(a, b))
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>
|
s141702677 | p00005 | Time Limit Exceeded |
import sys
def lcm(x, y):
if x > y:
greater = x
else:
greater = y
while(True):
if((greater % x == 0) and (greater % y == 0)):
lcm = greater
break
greater += 1
return lcm
def gcd(x, y):
while(y):
x = y
y = x%y
return x
for line in sys.stdin.readlines():
num1,num2 = map(int,line.split())
print(lcm(num1,num2),gcd(num1,num2)) | 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>
|
s868029847 | p00005 | Time Limit Exceeded | while True:
ans=""
try:
n=input().split()
except:
break
a,b=int(n[0]),int(n[1])
ma,mi=[],[]
for i in range(2,max(a,b)):
while a%i==0:
a/=i
ma.append(i)
if b%i==0:
b/=i
mi.append(i)
while b%i==0:
b/=i
ma.append(i)
check=1
for i in mi:
check*=i
ans+=str(check)+" "
check=1
for i in ma:
check*=i
ans+=str(check)
print(ans) | 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>
|
s757959565 | p00005 | Time Limit Exceeded | while True:
ans=""
try:
n=input().split()
except:
break
if n=="":
break
a,b=int(n[0]),int(n[1])
ma,mi=[],[]
count=2
while a!=1 and b!=1:
try:
check_0=max(a,b)
except:
break
for i in range(count,max(a,b)):
while a%i==0:
a/=i
ma.append(i)
if b%i==0:
b/=i
mi.append(i)
count=i
break
while b%i==0:
b/=i
ma.append(i)
count=i
break
check=1
for i in mi:
check*=i
ans+=str(check)+" "
check=1
for i in ma:
check*=i
ans+=str(check)
print(ans) | 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>
|
s588289317 | p00005 | Time Limit Exceeded | import sys
temp = []
largest = 1
for line in sys.stdin:
a,b = [int(x) for x in line.split()]
if a > b:
x,y = a,b
else:
x,y = b,a
i = x
while i > 1:
if (x % i) == 0 and (y % i) == 0:
x = x / i
y = y / i
largest *= i
i -= 1
smallest = largest * (a/largest) * (b/largest)
print('%d %d' % (largest, smallest))
largest = 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>
|
s437416126 | p00005 | Time Limit Exceeded | while True:
try:
n=input().split()
except:
break
num=[int(n[i]) for i in range(len(n))]
max=1
num=sorted(num)
for i in range(1,num[0]+1):
if num[0]%i==0:
if num[1]%i==0:
max=i
print(max,int(num[0]*num[1]/max)) | 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>
|
s983207009 | p00005 | Time Limit Exceeded | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
g = 1
for i in range(1, max([a, b])):
if(a % i == 0 and b % i == 0):
g = i
return g
def lcm(a, b):
for i in range(max([a, b]), a*b + 1):
if(i % a == 0 and i % b == 0):
return i
return a*b
for i in sys.stdin:
try:
line = [int(k) for k in i.split(" ")]
print(str(gcd(line[0], line[1])) + " " + str(lcm(line[0], line[1])))
except:
exit() | 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>
|
s146570775 | p00005 | Time Limit Exceeded | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
for i in range(max([a, b]), 0, -1):
if(a % i == 0 and b % i == 0):
return i
return 1
def lcm(a, b):
for i in range(max([a, b]), a*b + 1):
if(i % a == 0 and i % b == 0):
return i
return a*b
for i in sys.stdin:
try:
line = [int(k) for k in i.split(" ")]
g = gcd(line[0], line[1])
print(str(g) + " " + str(line[0]*line[1]//g)) # + str(lcm(line[0], line[1]))
except:
exit() | 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>
|
s931382974 | p00005 | Time Limit Exceeded | while True:
try:
list = [int(x) for x in raw_input().split(" ")]
list.sort(lambda x, y: y - x)
gcd = lcm = 0
m = list[0]
n = list[1]
while True:
r = m%n
if r == 0:
gcd = n
break
m = n
n = r
num = list[0]
while True:
if num%list[0] == num%list[1] == 0:
lcm = num
break
num += gcd
print(str(gcd) + " " + str(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>
|
s937734244 | p00005 | Time Limit Exceeded | from __future__ import (division, absolute_import, print_function,
unicode_literals)
import sys
for line in sys.stdin:
small, large = sorted(int(n) for n in line .split())
for i in xrange(small, 0, -1):
if large % i == 0 and small % i == 0:
gcd = i
break
for i in xrange(2, large + 1):
if i * small % large == 0:
lcm = i * small
break
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>
|
s007779075 | p00005 | Time Limit Exceeded | from __future__ import (division, absolute_import, print_function,
unicode_literals)
import sys
for line in sys.stdin:
small, large = sorted(int(n) for n in line .split())
for i in (n for n in xrange(small, 0, -1) if not small % n):
if not large % i:
gcd = i
break
for i in xrange(2, small + 1):
if not i * large % small:
lcm = i * large
break
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>
|
s487921355 | p00005 | Time Limit Exceeded | # -*- coding: utf-8 -*-
import sys
outList = []
for line in sys.stdin.readlines():
List = map(int, line.strip().split())
[a, b] = List
factorList = [[0], [1]]
# LCM
LCM = 1
for i in xrange(2, max(a, b)):
while(a % i == 0 and b % i == 0):
LCM *= i
a /= i
b /= i
# GCD
GCD = List[0] * b
print LCM, 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>
|
s232272436 | p00005 | Time Limit Exceeded | # -*- coding: utf-8 -*-
import sys
outList = []
for line in sys.stdin.readlines():
List = map(int, line.strip().split())
[a, b] = List
# LCM
LCM = 1
for i in xrange(2, max(a, b)):
while(a % i == 0 and b % i == 0):
LCM *= i
a /= i
b /= i
# GCD
GCD = List[0] * b
print LCM, 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>
|
s578727040 | p00005 | Time Limit Exceeded | # -*- coding: utf-8 -*-
import sys
def isprime(n):
for i in xrange(2, int(n ** 0.5)+1 ):
if n % i == 0: return False
return True
outList = []
for line in sys.stdin.readlines():
List = map(int, line.strip().split())
[a, b] = List
# LCM
LCM = 1
for i in xrange(2, min(a, b)):
if not isprime(i): continue
while(a % i == 0 and b % i == 0):
LCM *= i
a /= i
b /= i
# GCD
GCD = List[0] * b
print LCM, 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>
|
s377961626 | p00005 | Time Limit Exceeded | import itertools
while 1:
try:
a, b= map(int, raw_input().split())
GCD = a * b
LCM = 0
# GCD
for i, j in itertools.product(range((a if a > b else b) / 2), repeat=2):
if a * (i+1) == b * (j+1) and GCD > a * (i+1):
GCD = a * (i+1)
# LCM
for i in range(a if a > b else b, 1, -1):
if a % i == 0 and b % i == 0:
LCM = i
break
print str(GCD) + " " + str(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>
|
s792746271 | p00005 | Time Limit Exceeded | import itertools
ans_list = []
while 1:
try:
a, b= map(int, raw_input().split())
GCD = a * b
LCM = 0
# GCD
for i, j in itertools.product(range((a if a > b else b) / 2), repeat=2):
if a * (i+1) == b * (j+1) and GCD > a * (i+1):
GCD = a * (i+1)
# LCM
for i in range(a if a > b else b, 1, -1):
if a % i == 0 and b % i == 0:
LCM = i
break
ans_list.append(str(GCD) + " " + str(LCM))
except:
for s in ans_list:
print s
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>
|
s698574783 | p00005 | Time Limit Exceeded | import itertools
ans_list = []
while 1:
ab = raw_input()
if ab != "":
a, b= map(int, ab.split())
else:
for s in ans_list:
print s
break
GCD = a * b
LCM = 0
# GCD
for i, j in itertools.product(range((a if a > b else b) / 2), repeat=2):
if a * (i+1) == b * (j+1) and GCD > a * (i+1):
GCD = a * (i+1)
# LCM
for i in range(a if a > b else b, 1, -1):
if a % i == 0 and b % i == 0:
LCM = i
break
ans_list.append(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>
|
s779371559 | p00005 | Time Limit Exceeded | import itertools
import sys
ans_list = []
while 1:
ab = raw_input()
if ab != "":
a, b= map(int, ab.split())
else:
for s in ans_list:
print s
break
GCD = a * b
LCM = 0
# GCD
for i, j in itertools.product(range((a if a > b else b) / 2), repeat=2):
if a * (i+1) == b * (j+1) and GCD > a * (i+1):
GCD = a * (i+1)
# LCM
for i in range(a if a > b else b, 1, -1):
if a % i == 0 and b % i == 0:
LCM = i
break
ans_list.append(str(GCD) + " " + str(LCM))
sys.exit() | 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>
|
s579903365 | p00005 | Time Limit Exceeded | import itertools
while 1:
try:
a, b= map(int, raw_input().split())
except:
break
GCD = a * b
LCM = 0
# GCD
for i, j in itertools.product(range((a if a > b else b) / 2), repeat=2):
if a * (i+1) == b * (j+1) and GCD > a * (i+1):
GCD = a * (i+1)
# LCM
for i in range(a if a > b else b, 1, -1):
if a % i == 0 and b % i == 0:
LCM = i
break
print "{} {}".format(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>
|
s396811378 | p00005 | Time Limit Exceeded | import itertools
while 1:
try:
a, b= map(int, raw_input().split())
except:
break
GCD = a * b
LCM = 0
# GCD
for i, j in itertools.product(range((a if a > b else b) / 2), repeat=2):
if a * (i+1) == b * (j+1) and GCD > a * (i+1):
GCD = a * (i+1)
# LCM
flag = 0
for i in range(a if a > b else b, 1, -1):
if a % i == 0 and b % i == 0 and flag == 0:
LCM = i
flag += 1
print "{} {}".format(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>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.