submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s451321793
p00005
Runtime Error
import sys import math for line in sys.stdin: a, b = map(int, line.split(' ')) gcd = math.gcd(a, b) print(gcd, a * b // gcd)
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s835054357
p00005
Runtime Error
def GCD(a, b): if a % b == 0: return b else: yeah = a % b return GCD(b, yeah) def LCM(a, b, a_b_GCD): return int((a * b) / a_b_GCD) while True: a, b = map(int, input().split(' ')) a, b = max(a, b), min(a, b) print(GCD(a, b), LCM(a, b, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s995099541
p00005
Runtime Error
from math import gcd from sys import stdin for line in stdin: a,b = [int(i) for i in line.split()] g = gcd(a,b) print(g,int(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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s518542098
p00005
Runtime Error
import fractions as f while 1: 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s849196096
p00005
Runtime Error
class GCD(): def __init__(self,a,b): self.a = a self.b = b def swap(self): temp = self.a self.a = self.b self.b = temp def gcd(self): if self.b < self.a: self.swap() temp = self.b % self.a ans = self.b % temp return ans def lcm(self): gcd = self.gcd() temp = self.a * self.b ans = temp // gcd return gcd,ans def print(self): num = self.lcm() print("{0} {1}".format(num[0],num[1])) def main(): data = [] while 1: try: n = input().split() a = int(n[0]) b = int(n[1]) data.append(GCD(a, b)) except EOFError: break for array in data: array.print() 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s884401410
p00005
Runtime Error
class GCD(): def __init__(self,a,b): self.a = a self.b = b def swap(self): temp = self.a self.a = self.b self.b = temp def gcd(self): if self.b < self.a: self.swap() temp = self.b % self.a if temp == 0: ans = self.a return ans ans = self.b % temp return ans def lcm(self): gcd = self.gcd() temp = self.a * self.b ans = temp // gcd return gcd,ans def print(self): num = self.lcm() print("{0} {1}".format(num[0],num[1])) def main(): data = [] while 1: try: n = input().split() a = int(n[0]) b = int(n[1]) data.append(GCD(a, b)) except EOFError: break for array in data: array.print() 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s269708142
p00005
Runtime Error
def pd(n): i = 2 ans = [] while i ** 2 <= n: while n % i == 0: n /= i ans.append(i) i += 1 if n > 1: ans.append(n) return ans def gcd(a, b): gcd = 1 pd_a = pd(a) pd_b = pd(b) for i in pd_a: if i in pd_b: pd_b.remove(i) gcd *= i return int(gcd) def lcm(a, b): lcm = a pd_a = pd(a) pd_b = pd(b) for i in pd_a: if i in pd_b: pd_b.remove(i) for j in pd_b: lcm *= j return int(lcm) while True: s = input() if not s: break a,b = [int(i) for i in s.split(' ')] print(gcd(a, b), lcm(a, b))
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s912344737
p00005
Runtime Error
def gcd(a, b): while b: a, b = b, a%b return a while 1: a, b = map(int,input().split()) g = gcd(a, b) l = a / g * b print(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s656043166
p00005
Runtime Error
import sys def gcd(a, b): while b: a, b = b, a%b return a for line in sys.stdin: a, b = map(int,input().split()) g = gcd(a, b) l = a // g * b print(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s183662284
p00005
Runtime Error
import sys; def gcd(a, b): while b: a, b = b, a%b return a for line in sys.stdin: a, b = map(int,input().split()) g = gcd(a, b) l = a // g * b print(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s377397326
p00005
Runtime Error
import sys; def gcd(a, b): while b: a, b = b, a%b return a for line in sys.stdin: a, b = map(int,input().split()) g = gcd(a, b) l = a * b // g print(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s533550087
p00005
Runtime Error
import sys; def gcd(a, b): while b: a, b = b, a%b return a for line in sys.stdin: a, b = list(map(int,input().split())) g = gcd(a, b) l = a * b // g print(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s212223812
p00005
Runtime Error
import sys def get_divisor(num): divisor_list = [] for i in range(1, int(num/2)): divisor = num / i if divisor.is_integer(): divisor_list.append(i) divisor_list.append(int(divisor)) return list(set(divisor_list)) for line in sys.stdin.readlines(): ab = [int(str_) for str_ in line.split()] a_list = get_divisor(ab[0]) b_list = get_divisor(ab[1]) matched_list = [b for b in b_list if b in a_list] g = max(matched_list) l = int(ab[0]*ab[1] / g) print("{} {}".format(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s155281724
p00005
Runtime Error
import sys def get_divisor(num): divisor_list = [] for i in range(1, int(num/2)): divisor = num / i if divisor.is_integer(): divisor_list.append(i) divisor_list.append(int(divisor)) return list(set(divisor_list)) for line in sys.stdin.readlines(): ab = [int(str_) for str_ in line.split()] a_list = get_divisor(ab[0]) b_list = get_divisor(ab[1]) matched_list = [b for b in b_list if b in a_list] g = max(matched_list) l = int(ab[0]*ab[1] / g) print("{} {}".format(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s503249206
p00005
Runtime Error
import sys def get_divisor(num): divisor_list = [] for i in range(1, int(num/2)): divisor = num / i if divisor.is_integer(): divisor_list.append(i) divisor_list.append(int(divisor)) return list(set(divisor_list)) for line in sys.stdin: ab = [int(str_) for str_ in line.split()] a_list = get_divisor(ab[0]) b_list = get_divisor(ab[1]) matched_list = [b for b in b_list if b in a_list] g = max(matched_list) l = int(ab[0]*ab[1] / g) print("{} {}".format(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s348781204
p00005
Runtime Error
def get_divisor(num): divisor_list = [] for i in range(1, int(num/2)): divisor = num / i if divisor.is_integer(): divisor_list.append(i) divisor_list.append(int(divisor)) return list(set(divisor_list)) while True: ab = [int(str_) for str_ in input().split()] a_list = get_divisor(ab[0]) b_list = get_divisor(ab[1]) matched_list = [b for b in b_list if b in a_list] g = max(matched_list) l = int(ab[0]*ab[1] / g) print("{} {}".format(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s209973685
p00005
Runtime Error
import sys def get_divisor(num): divisor_list = [] for i in range(1, int(num/2)): divisor = num / i if divisor.is_integer(): divisor_list.append(i) divisor_list.append(int(divisor)) return list(set(divisor_list)) for line in sys.stdin.readlines(): ab = [int(str_) for str_ in line.split()] a_list = get_divisor(ab[0]) b_list = get_divisor(ab[1]) matched_list = [b for b in b_list if b in a_list] g = max(matched_list) l = int(ab[0]*ab[1] / g) print("{} {}".format(g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s449772842
p00005
Runtime Error
import sys def gcd(a,b): if a%b==0: return b return gcd(b,a%b) r=[map(int,line.split()) for line in sys.stdin] for i in r: o=gcd(i[0],i[i]) p=i[0]*i[1]/o print(o,p)
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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s760662313
p00005
Runtime Error
import sys def gcd(a,b): if a%b==0: return b return gcd(b,a%b) r=[list(map(int,line.split())) for line in sys.stdin] for i in r: o=gcd(i[0],i[i]) p=i[0]*i[1]/o print(o,p)
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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s551794757
p00005
Runtime Error
# Vol0005. 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s601229196
p00005
Runtime Error
def main(): while 1: 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s974630323
p00005
Runtime Error
from sys import stdin from sys import math def GCD(a,b): if(a%b==0): return b else: c = a%b return GCD(b,c) def LCM(a,b): gcd = GCD(a,b) return a*b/gcd for line in stdin: a,b = line.split(" ") a = int(a) b = int(b) gcd = GCD(a,b) lcm = math.floor(LCM(a,b)) print(str(gcd)+" "+str(lcm)) 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s192935609
p00005
Runtime Error
import sys def euc(n,m): if n == m: return m elif m == 1 | n == 1: return 1 else: return euc(min(n,m), max(n,m)-min(n,m)) for line in sys.stdin: a,b = [int(i) for i in line.split()] print(euc(a,b),int(a*b/euc(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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s206248897
p00005
Runtime Error
import sys def euc(n,m): if n == m: return m elif m == 1 | n == 1: return 1 else: return euc(min(n,m), max(n,m)-min(n,m)) for line in sys.stdin: a,b = [int(i) for i in line.split()] print(euc(a,b),int(a*b/euc(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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s556376627
p00005
Runtime Error
import sys def euc(n,m): if n == m: return m elif m == 1 or n == 1: return 1 else: return euc(min(n,m), max(n,m)-min(n,m)) for line in sys.stdin: a,b = [int(i) for i in line.split()] print(euc(a,b),int(a*b/euc(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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s675823898
p00005
Runtime Error
import sys def euc(n,m): if n == m: return m elif m == 1 or n == 1: return 1 else: return euc(min(n,m), max(n,m)-min(n,m)*int(max(n,m)/min(n,m))) for line in sys.stdin: a,b = [int(i) for i in line.split()] print(euc(a,b),int(a*b/euc(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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s735385868
p00005
Runtime Error
import sys def euc(n,m): if n%m == 0: return m else: return euc(min(n,m), max(n,m)%min(n,m)) for line in sys.stdin: a,b = [int(i) for i in line.split()] print(euc(a,b),int(a*b/euc(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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s447602078
p00005
Runtime Error
import sys;print"\n".join("%d %d"%(lambda l:(l[0],l[2]/l[0]*l[1]))(lambda f,l:(f(f,l),l[0],l[1]))(lambda f,l:l[1]==0 and l[0] or f(f,[l[1],l[0]%l[1]]),map(int,s.split()))for s in sys.stdin)
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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s239571748
p00005
Runtime Error
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 lcm = list[0] * list[1] / 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s430606131
p00005
Runtime Error
while True: ints = raw_input() if ints != '': x = map(int,ints.split(' ')) x.sort() a = x[1] b = x[0] while True: m=a%b if m!=0: a=b b=m continue else: break n = x[1]*x[0]/b print b,n
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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s983178262
p00005
Runtime Error
while True: ints = raw_input() if ints != '': x = map(int,ints.split(' ')) x.sort() a = x[1] b = x[0] while True: m=a%b if m!=0: a=b b=m continue else: break n = x[1]*x[0]/b print b,n continue else: 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s819617702
p00005
Runtime Error
import sys def euc(li): if (li[0] == 0 or li[1] == 0): return li[1]; return euc((li[0]-li[1],li[1]) if li[0]>li[1] else (li[1]-li[0],li[0])) for line in sys.stdin: [a,b] = [int(x) for x in line.split()] gcd = euc([a,b]) print gcd,a*b/gcd
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s463981468
p00005
Runtime Error
import sys def euc(li): if (li[0] == 0 or li[1] == 0): return li[1] return euc((li[0]-li[1],li[1]) if li[0]>li[1] else (li[1]-li[0],li[0])) for line in sys.stdin: [a,b] = [int(x) for x in line.split()] gcd = euc([a,b]) print gcd,a*b/gcd
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s144869435
p00005
Runtime Error
A , B = map(int,input().split()) a , b = A , B while a != b: if a < b: b = b-a elif b < a: a = a-b b = int(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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s849812989
p00005
Runtime Error
import sys for line in sys.stdin: a, b = sorted(map(int, line.split(' '))) gcd = 1 div = 2 while a >= div: amod, bmod = a % div, b % div if amod == 0 and bmod == 0; gcd *= div a, b = a/div, b/div continue else: div += 2 lcm = gcd * a * b print gcd, lcm
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s376316170
p00005
Runtime Error
import sys for line in sys.stdin: a, b = sorted(map(int, line.split(' '))) gcd = 1 div = 2 while a >= div: amod, bmod = a % div, b % div if amod == 0 and bmod == 0; gcd *= div a, b = a/div, b/div div = 2 continue else: div += 1 lcm = gcd * a * b print gcd, lcm
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s240093787
p00005
Runtime Error
import sys for line in sys.stdin: a, b = sorted(map(int, line.split(' '))) gcd = 1 d = 2 while a >= d: amod, bmod = a % d, b % d if amod == 0 and bmod == 0; gcd *= d a, b = a/d, b/d d = 2 continue else: d += 1 lcm = gcd * a * b print gcd, lcm
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s670602009
p00005
Runtime Error
import sys 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) for s in sys.stdin: i = map(int,raw_input().split()) print gcd(*i), lcm(*i)
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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s069641348
p00005
Runtime Error
import sys def gcm(a, b): if a<b: a,b=b,a if (a%b==0): return b else: return gcm(b,a%b) for s in stdin: a,b=map(int,s.split()) c=gcm(a,b) print "%d %d" %(c,a/c*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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s914090179
p00005
Runtime Error
# -*- 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)): 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 def isprime(n): for i in xrange(2, int(n ** 0.5) ): if n % i == 0: return False return True
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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s183051102
p00005
Runtime Error
# -*- 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)): 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 def isprime(n): for i in xrange(2, int(n ** 0.5)+1 ): if n % i == 0: return False return True
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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s722308880
p00005
Runtime Error
while True: a, b = map(int, raw_input().split()) def gcd(a, b): if b == 0: return a else: return gcd(b, a%b) g = gcd(a,b) l = a * b/gcd(a,b) print g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s161179891
p00005
Runtime Error
while True: try: a, b = map(int, raw_input().split()) def gcd(a, b): if b == 0: return a else: return gcd(b, a%b) g = gcd(a,b) l = a*b/gcd(a,b) print g, 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s289683351
p00005
Runtime Error
while True: try: a, b = map(int, raw_input().split()) def gcd(a, b): if b == 0: return a else: return gcd(b, a%b) g = gcd(a,b) l = a*b/gcd(a,b) print g, l 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s084431631
p00005
Runtime Error
while True: try: a, b = map(int, raw_input().split()) def gcd(a, b): if b == 0: return a else: return gcd(b, a%b) g = gcd(a,b) l = a*b/g print g, l 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s629557030
p00005
Runtime Error
while True: a,b = map(int, raw_input().split()) GCD = a if a > b else b LCM = a * b tmp = GCD #GCD 最大公約数 #LCM 最小公倍数 for i in range(tmp, 0, -1): if a % i == 0 and b % i == 0: GCD = i tmp = LCM for i in range(tmp, 0, -1): if i % a == 0 and i % i == 0: LCM = i print str(GCD) + " " + str(LCM)
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s119062712
p00005
Runtime Error
while True: a,b = map(int, raw_input().split()) GCD = a if a > b else b LCM = a * b tmp = GCD for i in range(tmp, 0, -1): if a % i == 0 and b % i == 0: GCD = i tmp = LCM for i in range(tmp, 0, -1): if i % a == 0 and i % i == 0: LCM = i print str(GCD) + " " + str(LCM)
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s071281512
p00005
Runtime Error
while True: try: a,b = map(int, raw_input().split()) GCD = a if a > b else b LCM = a * b tmp = GCD for i in range(tmp, 0, -1): if a % i == 0 and b % i == 0: GCD = i tmp = LCM for i in range(tmp, 0, -1): if i % a == 0 and i % i == 0: LCM = i 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s024702816
p00005
Runtime Error
def gcd(a,b): while a%b: a,b=b,a%b return b def lcm(a,b): return a*b/gcd(a,b) while 1: a,b=map(int, raw_input().split()) print gcd(a,b),lcm(a,b)
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s004179199
p00005
Runtime Error
def gcd(a,b): while a%b: a,b=b,a%b return b def lcm(a,b): return a*b/gcd(a,b) while 1: a,b=map(int, raw_input().split()) a,b=max(a,b),min(a,b) print gcd(a,b),lcm(a,b)
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s824300814
p00005
Runtime Error
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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s536072190
p00005
Runtime Error
i=a j=a while i>0: if b%i==0 and a%i==0: print i break else: i=i-1 while j>0:   if j%b==0 and j%a==0: print j break else: j=j+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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s253285958
p00005
WA: Presentation Error
import sys from fractions import gcd [print("{}{}".format(gcd(k[0], k[1]), k[0] * k[1] // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s594875570
p00005
WA: Presentation Error
import sys from fractions import gcd [print("{}{}".format(gcd(k[0], k[1]), (k[0] * k[1]) // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]
8 6 50000000 30000000
2 24 10000000 150000000
<H1>GCD and LCM</H1> <p> Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF. </p> <h2>Constraints</h2> <ul> <li> 0 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s016251102
p00005
WA: Presentation Error
import sys def gcd(m, n): if n != 0: return gcd(n, m % n) else: return m for line in sys.stdin.readlines(): m, n = map(int, line.split()) g = gcd(m, n) l = m * n // g # LCM print(g, ' ', 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s661859014
p00005
WA: Presentation Error
from sys import stdin import math def GCD(a,b): if(a%b==0): return b else: c = a%b return GCD(b,c) def LCM(a,b): gcd = GCD(a,b) return a*b/gcd for line in stdin: a,b = line.split(" ") a = int(a) b = int(b) gcd = GCD(a,b) lcm = math.floor(LCM(a,b)) print(str(gcd)+" "+str(lcm)) 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s015304517
p00005
WA: Presentation Error
from sys import stdin import math def GCD(a,b): if(a%b==0): return b else: c = a%b return GCD(b,c) def LCM(a,b): gcd = GCD(a,b) return int(a*b/gcd) for line in stdin: a,b = line.split(" ") a = int(a) b = int(b) gcd = GCD(a,b) lcm = LCM(a,b) print(str(gcd)+" "+str(lcm)) 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 &lt; <var>a, b</var> &le; 2,000,000,000</li> <li> LCM(<var>a, b</var>) &le; 2,000,000,000</li> <li> The number of data sets &le; 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>
s187623890
p00006
Wrong Answer
print(reversed(input()))
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s963627881
p00006
Wrong Answer
print(input()[-1])
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s186824781
p00006
Wrong Answer
import sys line = sys.stdin.readlines(); ret = ""; for i in range(1,len(line)): ret += line[len(line)-1-i]; print ret
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s251933130
p00006
Wrong Answer
line = input() ret = ""; for i in range(1,len(line)): ret += line[len(line)-1-i]; print(ret)
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s274335596
p00006
Wrong Answer
import sys line = sys.stdin.readlines(); ret = ""; for i in range(1,len(line)): ret += line[len(line)-1-i] print ret
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s458584345
p00006
Wrong Answer
import sys for str in sys.stdin: rev = "" for x in range(len(str),0,-1): rev=rev+str[x-1]
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s023901645
p00006
Wrong Answer
print(reversed(input()))
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s730654242
p00006
Wrong Answer
def main(): while True: try: IN=input() if IN=='': break print(IN[::-1]) except: break
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s481299934
p00006
Wrong Answer
a=list(input()) a.reverse() print(a)
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s211364098
p00006
Wrong Answer
import sys print(sys.stdin.readline()[:-1:-1])
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s999103307
p00006
Wrong Answer
listtest = ["a","b","c"] str1 = raw_input() strList = list(str1) print strList[::-1]
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s262912329
p00006
Wrong Answer
str1 = raw_input() strList = list(str1) print strList[::-1]
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s295498138
p00006
Wrong Answer
List = list(raw_input()) List.reverse() print List
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s356936366
p00006
Wrong Answer
List = list(raw_input()) List.reverse() print str(List)
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s712125378
p00006
Wrong Answer
print(str(reversed(input())))
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s607480231
p00006
Wrong Answer
print(input()[::-3])
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s737017931
p00006
Wrong Answer
import sys for a in sys.stdin.readline(): print(a[::-1])
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s307712445
p00006
Wrong Answer
import sys for a in sys.stdin.readline()[:-1]: print(a[::-1])
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s312517616
p00006
Wrong Answer
str = input() reverse_str = sorted(str, reverse=True) print("".join(reverse_str))
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s737467378
p00006
Wrong Answer
s = raw_input() s = s[::-1]
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s677927315
p00006
Wrong Answer
import math import sys lines = input() print(lines[0:len(lines)-1:-1])
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s083754637
p00006
Wrong Answer
import sys #from me.io import dup_file_stdin #@dup_file_stdin def solve(): l=list(sys.stdin) l.reverse() print(''.join(l)) solve()
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s878183022
p00006
Wrong Answer
str = [] a = raw_input() count = len(a) str = list(a) for i in range(0,count): str[i] = str[count - i -1] print ''.join(str)
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s970677126
p00006
Wrong Answer
string = input("input data") size = len(string) st = [] for i in range(size): st.append(string[size-i-1]) print(''.join(st))
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s782027285
p00006
Wrong Answer
string = input("input data") size = len(string) st = [] for i in range(size): st.append(string[size-i-1]) print(''.join(st))
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s994155529
p00006
Wrong Answer
string = input("input data") size = len(string) st = [] for i in range(size): st.append(string[size-i-1]) print(''.join(st), end='')
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s402928211
p00006
Wrong Answer
string = input("input data") size = len(string) st = [] for i in range(size): st.append(string[size-i-1]) print(''.join(st), end='') print('')
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s104232112
p00006
Wrong Answer
a=list(list(map(str, input().split())))
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s455234194
p00006
Wrong Answer
txt = input("") for i in range(0,len(txt)): print(txt[(len(txt)-i-1)],end="") print()
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s380971703
p00006
Wrong Answer
import sys for i in sys.stdin.readlines(): print reversed(i.strip())
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s311402605
p00006
Wrong Answer
str = raw_input() revstr = '' for x in str: revstr += x print revstr
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s813212114
p00006
Wrong Answer
line = raw_input().strip() reversed(line) print line
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s542368847
p00006
Wrong Answer
import sys for line in sys.stdin: print sorted(line, reverse=True)
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s756390154
p00006
Wrong Answer
import sys for line in sys.stdin: print sorted(line.rstrip('\n'), reverse=True)
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s276063532
p00006
Wrong Answer
import sys for line in sys.stdin: print ''.join(sorted(line.rstrip('\n'), reverse=True))
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s793362732
p00006
Wrong Answer
import sys for line in sys.stdin: print ''.join(sorted(line.rstrip('\n'), reverse=True)),
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s320344990
p00006
Wrong Answer
import sys for line in sys.stdin: print reversed(line)
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s755647847
p00006
Wrong Answer
# -*- coding: utf-8 -*- import sys for line in sys.stdin.readlines(): #List = map(int, line.strip().split()) seq = line.split() print seq[::-1]
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s207412650
p00006
Accepted
print(input()[::-1])
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s138251117
p00006
Accepted
s = input().rstrip() print(s[::-1])
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s553583886
p00006
Accepted
a = input() b = a[::-1] print(b)
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s789134150
p00006
Accepted
print raw_input()[::-1]
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>
s944901856
p00006
Accepted
def reverseString(s): return s[::-1] while True: try: s = str(input()) s = reverseString(s) print(s) except: break
w32nimda
admin23w
<H1>Reverse Sequence</H1> <p> Write a program which reverses a given string <var>str</var>. </p> <H2>Input</H2> <p> <var>str</var> (the size of <var>str</var> &le; 20) is given in a line. </p> <H2>Output</H2> <p> Print the reversed <var>str</var> in a line. </p> <H2>Sample Input</H2> <pre> w32nimda </pre> <H2>Output for the Sample Input</H2> <pre> admin23w </pre>