s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s177108548
p02256
u299231628
1519282039
Python
Python3
py
Accepted
20
5600
183
x, y = map(int, input().split()) def gcd(x,y): if x < y: x, y = y, x d = int() while y > 0: r = x % y x, y = y, r return x print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,082
s172879437
p02256
u581154076
1520007784
Python
Python3
py
Accepted
20
5604
213
def gcd(x, y): if x < y: x, y = y, x while y > 0: r = x % y x = y y = r return x def main(): x, y = (int(n) for n in input().split()) print(gcd(x, y)) main()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,083
s140254853
p02256
u508054630
1520551777
Python
Python3
py
Accepted
20
5600
212
def GSD(x, y): while True: x0 = max(x, y) y0 = min(x, y) if x0 % y0 == 0: return y0 x = x0 % y0 y = y0 x, y = map(int, input().split(' ')) print(GSD(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,084
s497596358
p02256
u613534067
1520651684
Python
Python3
py
Accepted
20
5600
177
# 最大公約数(greatest common divisor)を求める関数 def gcd(a, b): while b: a, b = b, a % b return a a, b = map(int, input().split()) print(gcd(a, b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,085
s858168008
p02256
u202430481
1520731916
Python
Python3
py
Accepted
20
5596
162
str_input = input() list_input = str_input.split(" ") x = int(list_input[0]) y = int(list_input[1]) while y != 0: mod = x % y x = y y = mod print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,086
s362890198
p02256
u508054630
1521534576
Python
Python3
py
Accepted
20
5596
134
#Euclidean Algorithm x, y = map(int, input().split(' ')) q = x % y while q != 0: t = y y = q x = t q = x % y print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,087
s885815919
p02256
u464859367
1522056628
Python
Python3
py
Accepted
20
5600
140
n = list(map(int, input().split())) x = n[0] y = n[1] if x < y: x, y = y, x while y > 0: r = x % y x = y y = r print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,088
s461624254
p02256
u285980122
1522303092
Python
Python3
py
Accepted
20
5600
240
def gcd(x, y): if x < y: tmp = x x = y y = tmp while y > 0: r = x % y x = y y = r return print(x) x_y = input() tmp = list(map(int, x_y.split())) x = tmp[0] y = tmp[1] gcd(x, y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,089
s783946761
p02256
u110280195
1522413246
Python
Python3
py
Accepted
30
6000
256
from collections import defaultdict def gcd(x,y): if max(x,y) % min(x,y) == 0 : return min(x,y) else : return gcd(min(x,y) ,max(x,y)%min(x,y)) if __name__ == '__main__' : a,b = [int(i) for i in input().split(" ")] print(gcd(a,b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,090
s809072452
p02256
u566311709
1522468671
Python
Python3
py
Accepted
20
5592
162
x, y = sorted(list(map(int, input().split())), reverse=True) while 1: if x % y == 0: print(y) break else: a = y b = x % y x = a y = b
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,091
s728046980
p02256
u566311709
1522468920
Python
Python3
py
Accepted
20
5588
67
a, b = map(int, input().split()) while b: a, b = b, a % b print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,092
s776899221
p02256
u908984540
1522620695
Python
Python3
py
Accepted
20
5600
246
def greatest_common_division(x, y): if x < y: x, y = y, x if y == 0 or x == y: return x else: return greatest_common_division(y, x % y) x, y = map(int, input().split()) print(greatest_common_division(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,093
s422498097
p02256
u138546245
1522705934
Python
Python3
py
Accepted
20
5616
385
def gcd(a, b): """calculate the greatest common divisor of a, b >>> gcd(54, 20) 2 >>> gcd(147, 105) 21 >>> gcd(100000002, 39273000) 114 """ if a > b: a, b = b, a if a == 0: return b return gcd(b % a, a) def run(): a, b = [int(i) for i in input().split...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,094
s019267673
p02256
u662418022
1523282708
Python
Python3
py
Accepted
20
5604
242
# -*- coding: utf-8 -*- def gcd(x, y): if x < y: x, y = y, x while y > 0: r = x % y x = y y = r return x if __name__ == '__main__': x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,095
s742984616
p02256
u269391636
1523283869
Python
Python3
py
Accepted
20
5600
137
a = list(map(int, input().split())) t , u = a[0],a[1] def c(x,y): if x % y: return(c(y,x%y)) else: return(y) print(c(t,u))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,096
s800806644
p02256
u027874809
1523423845
Python
Python3
py
Accepted
20
5600
202
def gcd(a, b): if b == 0: return a return gcd(b, a % b) alllist = list(map(int, input().split())) alllist = sorted(alllist, reverse=True) result = gcd(alllist[0], alllist[1]) print(result)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,097
s304415423
p02256
u017435045
1523942586
Python
Python3
py
Accepted
20
5600
128
x, y = [int(x) for x in input().split()] def gcd(a, b): m = a%b return gcd(b, m) if m else b print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,098
s912616585
p02256
u252641015
1524038489
Python
Python
py
Accepted
10
4636
131
def gcd(x,y): if y==0: return x else: return gcd(y,x%y) x,y=map(int,raw_input().split()) print(gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,099
s601484080
p02256
u064320529
1524038740
Python
Python3
py
Accepted
20
5596
101
s=input() r=s.split() x=int(r[0]) y=int(r[1]) r=x%y while r!=0: x=y y=r r=x%y print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,100
s764981278
p02256
u896240461
1524039505
Python
Python3
py
Accepted
20
5600
138
def gcd(x,y): while y > 0: r = x % y x = y y = r return x x,y = map(int,input().split()) print(gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,101
s231339903
p02256
u032728894
1524039519
Python
Python3
py
Accepted
20
5656
267
#16D8102008K 1-D Greatest Common Divisor 柳生 葉月 Yagyu Hauzki import math a,b=map(int,input().split()) def f(x,y): while(1): tmp=x%y x=y y=tmp if tmp==0: gcd=x break return gcd print(f(a,b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,102
s240646538
p02256
u063056051
1524039547
Python
Python3
py
Accepted
20
5596
124
x,y=map(int,input().split()) a=1 while a!=0: if x>y: a=x%y else: a=y%x x=y y=a print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,103
s914565605
p02256
u728137020
1524039608
Python
Python3
py
Accepted
20
5596
145
x,y = map(int, input().split()) i=1 while i!=0: if x>y: i=x%y x=y y=i else: i=y%x y=i print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,104
s356515025
p02256
u909075105
1524039611
Python
Python3
py
Accepted
20
5596
243
#16D8101023J 久保田凌弥 kubotarouxxx python3 x,y=map(int, input().split()) if x>y: while 1: if (x%y)==0: print(y) break a=x%y x=y y=a else: while 1: if (y%x)==0: print(x) break a=y%x y=x x=a
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,105
s954964646
p02256
u477717106
1524039848
Python
Python3
py
Accepted
20
5600
165
line=input().split() x=int(line[0]) y=int(line[1]) def gcd(x,y): r=x%y while(r>0): x=y y=r r=x%y return y print (gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,106
s155840599
p02256
u848218390
1524040542
Python
Python3
py
Accepted
20
5600
224
def gcd(x, y): if x < y: tmp = x x = y y = tmp r = x % y while r != 0: x = y y = r r = x % y return y x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,107
s708425668
p02256
u564105430
1524040645
Python
Python3
py
Accepted
20
5600
179
def gcd(x,y): if x<y: tmp=x x=y y=tmp while y>0: r=x%y x=y y=r return x x,y=map(int,input().split()) print(gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,108
s412660241
p02256
u776834150
1524040763
Python
Python3
py
Accepted
20
5656
85
import math line=input().split() x=int(line[0]) y=int(line[1]) print(math.gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,109
s842225070
p02256
u684325232
1524041842
Python
Python3
py
Accepted
20
5600
226
list=[int(i) for i in input().split()] if list[0]>list[1]: a=list[0] b=list[1] else: b=list[0] a=list[1] if a%b==0: print(b) else: while b>0: c=a%b a=b b=c print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,110
s126087376
p02256
u055885332
1524050805
Python
Python3
py
Accepted
20
5600
181
def cgd(x,y): while(True): r=x%y if r==0: m=y break x=y y=r return m a,b=map(int,input().split()) if a>b: m=cgd(a,b) elif a<b: m=cgd(b,a) else: m=a print(m)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,111
s398966820
p02256
u196653484
1524109140
Python
Python3
py
Accepted
20
5600
291
#16D8101012J 伊藤惇 dj Python3 def Greatest_Common_Divisor(x,y): if y>x: x,y=y,x if x>=y and y>0: return Greatest_Common_Divisor(y,x%y) return x if __name__ == "__main__": x=list(map(int,input().split())) print(Greatest_Common_Divisor(x[0],x[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,112
s128527733
p02256
u411881271
1524111194
Python
Python3
py
Accepted
20
5596
75
a,b=map(int,input().split()) x=a%b while x>0: a=b b=x x=a%b print(b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,113
s365985174
p02256
u684325232
1524112295
Python
Python3
py
Accepted
20
5604
225
list=[int(i) for i in input().split()] if list[0]>list[1]: a=list[0] b=list[1] else: b=list[0] a=list[1] if a%b==0: print(b) else: while b>0: c=a%b a=b b=c print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,114
s447931113
p02256
u217703215
1524113029
Python
Python3
py
Accepted
20
5596
83
x,y=map(int,input().split()) c=x%y while c!=0: x=y y=c c=x%y print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,115
s522230039
p02256
u836567931
1524119373
Python
Python3
py
Accepted
20
5600
148
def gcd(a, b): if b == 0: return a return gcd(b, a%b) a, b = map(int, input().split()) if a < b: a, b = b, a print(gcd(a, b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,116
s995636951
p02256
u405027099
1524131272
Python
Python3
py
Accepted
20
5596
95
x,y=map(int,input().split()) a=1 while a!=0: a=x%y tmp=y y=a x=tmp print(tmp)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,117
s610897086
p02256
u826549974
1524213076
Python
Python3
py
Accepted
20
5604
141
def gc(x, y): while y > 0: x %= y x, y = y, x return x A = [int(i) for i in input().split()] print(gc(A[0],A[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,118
s828943277
p02256
u826549974
1524213290
Python
Python3
py
Accepted
20
5616
280
def GCD(x,y): if(x >= y): z = y w = x%y else: z = x w = y%x if(not(w == 0)): return GCD(z,w) else: return z A = [int(i) for i in input().split()] print(GCD(A[0],A[1])) """実行結果 100 55 5 66 77 11 """
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,119
s736837056
p02256
u564464686
1524215748
Python
Python3
py
Accepted
20
5596
192
def gcd(x,y): r=x%y if r==0: return y else: return gcd(y,r) x,y=map(int, input().split()) if x>y: r=gcd(x,y) if x==y: r=x if x<y: r=gcd(y,x); print(r)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,120
s666493638
p02256
u861315468
1524240364
Python
Python3
py
Accepted
20
5604
186
def gcd(x,y): if x<=y: tmp=x x=y y=tmp r=x%y while(r!=0): x=y y=r r=x%y return y a=input().split() b=[int(i) for i in a] print(gcd(b[0],b[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,121
s278725097
p02256
u165447384
1524299606
Python
Python3
py
Accepted
20
5596
148
#ALDS 1-B: Greatest Common Divisor x = input().split() a = int(x[0]) b = int(x[1]) while(a % b != 0): c = b b = a % b a = c print(b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,122
s505123519
p02256
u517313267
1524404950
Python
Python3
py
Accepted
20
5596
209
if __name__ == '__main__': s = input().split() if s[0] < s[1]: tmp = s[0] s[0] = s[1] s[1] = tmp while True: x = int(s[0]) % int(s[1]) if x==0: break s[0] = s[1] s[1] = x print (s[1])
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,123
s970739235
p02256
u408444038
1524421779
Python
Python3
py
Accepted
20
5600
230
def gcd(x,y): while 1: tmp = x%y if tmp==0: return y x = y y = tmp a = list(map(int, input().split())) if a[0]<=a[1]: s = gcd(a[1],a[0]) else: s = gcd(a[0],a[1]) print(s)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,124
s244030271
p02256
u481571686
1524493182
Python
Python3
py
Accepted
20
5588
74
x,y=map(int,input().split()) while x%y!=0: tmp=y y=x%y x=tmp print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,125
s005621241
p02256
u398978447
1524561915
Python
Python3
py
Accepted
20
5596
96
x,y=map(int,input().split()) r=x%y while r!=0: x=y y=r r=x%y print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,126
s202787152
p02256
u573915636
1524625362
Python
Python3
py
Accepted
20
5592
195
n=input().split() x=int(n[0]) y=int(n[1]) if 1<=x<1000000000 and 1<=y<=1000000000: if x>y: while y!=0: t=y y=x%t x=t print(x) else: while x!=0: t=x x=y%t y=t print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,127
s069709928
p02256
u126478680
1524632096
Python
Python3
py
Accepted
20
5604
327
#! python3 # greatest_common_divisor.py def greatest_common_divisor(x, y): r = None if x >= y: r = x%y if r == 0: return y else: r = y%x if r == 0: return x return greatest_common_divisor(y, r) x, y = [int(n) for n in input().split(' ')] print(greatest_common_divisor(...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,128
s737110542
p02256
u148477094
1524635979
Python
Python3
py
Accepted
20
5600
143
def gcd(a,b): if b==0: return a c=a%b return gcd(b,c) x,y=map(int,input().split()) if x<y: x,y=y,x m=gcd(x,y) print(m)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,129
s212961893
p02256
u255317651
1524662242
Python
Python3
py
Accepted
20
5600
242
def gcm(x, y): if x == 0: return y if y == 0: return x if x==y: return x if x>y: return gcm(x%y,y) else: return gcm(y%x,x) x, y = list(map(int, input().split())) print(gcm(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,130
s366518187
p02256
u908651435
1524821813
Python
Python3
py
Accepted
30
5588
101
def gcd(m, n): r = m % n return gcd(n, r) if r else n print(gcd(*map(int, input().split())))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,131
s177104790
p02256
u908651435
1524822923
Python
Python3
py
Accepted
20
5596
270
if __name__ == '__main__': s = input().split() if s[0] < s[1]: tmp = s[0] s[0] = s[1] s[1] = tmp while True: x = int(s[0]) % int(s[1]) if x==0: break s[0] = s[1] s[1] = x print (s[1])
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,132
s727308230
p02256
u023471147
1525237783
Python
Python3
py
Accepted
20
5600
110
a, b = map(int, input().split()) while b > 0: if a < b: a, b = b, a a, b = b, a % b print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,133
s498267194
p02256
u142825584
1525455192
Python
Python3
py
Accepted
20
5600
176
def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) def main(): l, r = tuple(map(int, input().split(' '))) print(gcd(l, r)) main()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,134
s462461575
p02256
u682153677
1525511057
Python
Python3
py
Accepted
20
5596
106
# -*- coding: utf-8 -*- x, y = map(int, input().split()) while y != 0: x, y = y, (x % y) print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,135
s709428741
p02256
u938045879
1526223558
Python
Python3
py
Accepted
20
5596
191
x, y = map(int, input().split(' ')) def gcd(x1,x2): if(x2 == 0): return x1 else: return gcd(x2, x1 % x2) if(x>=y): print(gcd(x,y)) else: print(gcd(y,x))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,136
s087834370
p02256
u641357568
1526335727
Python
Python3
py
Accepted
30
5600
157
x, y = [ int(i) for i in input().split()] if x > y: x, y = y, x while True: if x % y: x, y = y, x % y continue break print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,137
s574239782
p02256
u294922877
1526448780
Python
Python3
py
Accepted
20
5612
262
""" 最大公約数を求める """ def gcd(a, b): while (a != 0 and b != 0): if (a >= b): a = a % b else: b = b % a return a+b if __name__ == '__main__': x, y = map(int, input().split()) print(gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,138
s495093232
p02256
u810922275
1527034472
Python
Python3
py
Accepted
20
5600
151
def gcd(x,y): if y==0: return x else: x=x%y return gcd(y,x) A=list(map(int,input().split(' '))) print(gcd(A[0],A[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,139
s429730625
p02256
u604437890
1527139655
Python
Python3
py
Accepted
20
5652
68
import math x, y = map(int, input().split()) print(math.gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,140
s754149772
p02256
u986478725
1527420033
Python
Python3
py
Accepted
20
5600
554
# ALDS_1_B. 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(): a...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,141
s640717399
p02256
u002280517
1527575448
Python
Python3
py
Accepted
20
5652
67
import math x, y = map(int,input().split()) print(math.gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,142
s112303029
p02256
u318430977
1527607262
Python
Python3
py
Accepted
20
5600
216
def gcd(x, y): if x <= y: tmp = x x = y y = tmp if y == 0: return x return gcd(y, x % y) inputs = input().split() x = int(inputs[0]) y = int(inputs[1]) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,143
s576696400
p02256
u011621222
1527862845
Python
Python3
py
Accepted
20
5660
189
import math def gcd(a,b): if a<b: a,b=b,a c=a%b if c==0: return b else: return gcd(b,c) S=[ int(x) for x in input().split()] print(gcd(S[0],S[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,144
s339347344
p02256
u158021138
1528100336
Python
Python3
py
Accepted
20
5664
78
import math x, y = [int(i) for i in input().split()] print(math.gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,145
s852358510
p02256
u158021138
1528100620
Python
Python3
py
Accepted
20
5604
188
def gcd(x,y): if x<y: x, y = y, x r = x%y while(r>0): x=y y=r r = x%y return y x, y = [int(i) for i in input().split()] print(gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,146
s044070308
p02256
u777277984
1528266509
Python
Python3
py
Accepted
20
5600
118
def gcd(x, y): if x % y == 0: return y return gcd(y, x%y) x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,147
s128494407
p02256
u971076135
1528411030
Python
Python3
py
Accepted
20
5604
263
from sys import stdin def stdinput(): return stdin.readline().strip() def main(): a, b = map(int, stdinput().split()) a, b = min(a, b), max(a, b) while b % a != 0: a, b = b % a, a print(a) if __name__ == '__main__': main()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,148
s542556987
p02256
u596110276
1528505851
Python
Python3
py
Accepted
20
5652
73
import math x, y = list(map(int, input().split())) print(math.gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,149
s527438599
p02256
u327546577
1528570352
Python
Python3
py
Accepted
20
5596
108
def gcd(a, b): return gcd(b, a % b) if b != 0 else a a, b = map(int, input().split()) print(gcd(a, b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,150
s483880773
p02256
u657361950
1528723722
Python
Python3
py
Accepted
20
5592
150
arr = list(map(int, input().split())) n1 = min(arr[0], arr[1]) n2 = max(arr[0], arr[1]) while n1 != 0: temp = n2 % n1 n2 = n1 n1 = temp print(n2)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,151
s159791444
p02256
u929141425
1528971530
Python
Python3
py
Accepted
20
5596
185
x, y = map(int, input().split()) while True: if y > x: a = x x = y y = a x = x % y #print(f"{x} {y}") if x == 0: print(y) break
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,152
s686594721
p02256
u867824281
1529024285
Python
Python3
py
Accepted
20
5652
64
import math x,y = map(int,input().split()) print(math.gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,153
s005287643
p02256
u657361950
1529027671
Python
Python3
py
Accepted
20
5596
125
n1, n2 = map(int, input().split()) a = min(n1, n2) b = max(n1, n2) while a != 0: temp = b % a b = a a = temp print(b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,154
s877037875
p02256
u300095814
1529041713
Python
Python3
py
Accepted
20
5600
92
x,y = map(int, input().split()) if y < x: x,y = y,x while x%y: x,y = y,x%y print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,155
s078156090
p02256
u292798607
1529043317
Python
Python3
py
Accepted
20
5596
146
a,b = map(int, input().split()) if(a < b): swap = a a = b b = swap x = 1 while(x != 0): x = a % b a = b b = x print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,156
s412477739
p02256
u298224238
1529093400
Python
Python3
py
Accepted
20
5604
149
x, y = [int(n) for n in input().split()] def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,157
s543762906
p02256
u298224238
1529093436
Python
Python3
py
Accepted
20
5604
112
x, y = [int(n) for n in input().split()] if (x < y): x, y = y, x while y: (x, y) = (y, x % y) print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,158
s393085231
p02256
u298224238
1529093575
Python
Python3
py
Accepted
20
5604
112
x, y = [int(n) for n in input().split()] if (x < y): x, y = y, x while y: (x, y) = (y, x % y) print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,159
s749627525
p02256
u269568674
1529333291
Python
Python3
py
Accepted
20
5604
192
l=input().split() l = [int(s) for s in l] a = l[0] b = l[1] while (b != 0 and a != 0): if(a < b): b = b % a else: a = a % b if(a == 0): print(b) else: print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,160
s347481502
p02256
u995990363
1529477634
Python
Python3
py
Accepted
20
5604
252
def gcd(x,y): _x = min(x,y) _y = max(x,y) _z = _y % _x if _z == 0: return _x else: return gcd(_x,_z) def run(): x, y = [int(i) for i in input().split()] print(gcd(x,y)) if __name__ == '__main__': run()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,161
s901604720
p02256
u188938853
1529483683
Python
Python3
py
Accepted
20
5604
165
def gcd(x, y): if x < y: x, y = y, x if y == 0: return x return gcd(y, x % y) x, y = [int(i) for i in input().split()] print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,162
s835705671
p02256
u188938853
1529483702
Python
Python3
py
Accepted
20
5604
157
def gcd(x, y): if y == 0: return x return gcd(y, x % y) x, y = [int(i) for i in input().split()] if x < y: x, y = y, x print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,163
s637394075
p02256
u808223843
1529491571
Python
Python3
py
Accepted
20
5604
140
x,y=[int(i) for i in input().split()] if x<y: x,y=y,x while True: if y==0: print(x) break a=x%y x=y y=a
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,164
s822864067
p02256
u922112509
1529556361
Python
Python3
py
Accepted
20
5600
253
# Greatest Common Divisor numbers = [int(i) for i in input().rstrip().split()] a = numbers[0] b = numbers[1] gcd = 1 while a != 0 and b != 0: if a >= b: a %= b else: b %= a if a == 0: gcd = b else: gcd = a print(gcd)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,165
s449789423
p02256
u922112509
1529556420
Python
Python3
py
Accepted
20
5604
329
# Greatest Common Divisor numbers = [int(i) for i in input().rstrip().split()] a = numbers[0] b = numbers[1] def gcd(a, b): gcd = 1 while a != 0 and b != 0: if a >= b: a %= b else: b %= a if a == 0: gcd = b else: gcd = a return gcd print(gcd...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,166
s321722958
p02256
u023997525
1529751079
Python
Python3
py
Accepted
20
5600
172
def gcd(a, b): # 0とか負の数が入るとヤバい if b%a==0: return a return gcd(b%a, a) x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,167
s881813109
p02256
u023997525
1529751123
Python
Python3
py
Accepted
30
5600
257
def gcd_loop(a,b): if a < 0: a = -a if b < 0: b = -b if b < a: b, a = a, b if a == 0: return b while True: if b%a == 0: return a a, b = b%a, a x, y = map(int, input().split()) print(gcd_loop(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,168
s125682867
p02256
u316584871
1530081747
Python
Python3
py
Accepted
20
5600
527
a, b = map(int, input().split()) slist = [] if (a > b): c = a%b d = b while (c != 0 and d != 0): if (c < d): d = d%c elif (c > d): c = c%d if(c == 0): print(d) elif(d == 0): print(c) elif(a < b): c = a d = b%a while (c...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,169
s021803388
p02256
u501332306
1530097307
Python
Python3
py
Accepted
20
5604
138
x,y =[int(i) for i in input().split()] if x < y : t = x x = y y = t while y > 0 : r = x % y x = y y = r print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,170
s029995044
p02256
u418996726
1530135626
Python
Python3
py
Accepted
20
5596
135
a, b = map(int, input().split()) if b > a: t = b b = a a = t while not b == 0: t = b b = a % b a = t print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,171
s708914401
p02256
u418996726
1530226034
Python
Python3
py
Accepted
20
5596
136
a, b = map(int, input().split()) if b > a: t = b b = a a = t while not b == 0: t = b b = a % b a = t print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,172
s094100690
p02256
u320121447
1530362591
Python
Python3
py
Accepted
20
5604
146
def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) x, y = [int(w) for w in input().split()] print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,173
s118483557
p02256
u418996726
1530574924
Python
Python3
py
Accepted
20
5596
129
a,b = map(int, input().split()) if b > a: t = b b = a a = t while b != 0: t = b b = a % b a = t print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,174
s193618757
p02256
u763301852
1363525905
Python
Python
py
Accepted
10
4216
226
a, b = map(int, raw_input().split()) c = 0 while True: if a == b: c = a break if a < b: tmp = b b = a a = tmp a = a % b if a == 0: c = b break print(c)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,175
s799717353
p02256
u912237403
1371256600
Python
Python
py
Accepted
10
4220
171
def gcd(a,b): if b > a: a, b = b, a if b == 0: return a else: return gcd(b, a % b) a, b = map(int, raw_input().split()) print gcd(a,b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,176
s251766067
p02256
u572424947
1376567526
Python
Python
py
Accepted
10
4208
116
data = map(int, raw_input().split()) x = data[0] y = data[1] m = 1 while m != 0: m = x % y x = y y = m print x
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,177
s691852530
p02256
u782850731
1379655981
Python
Python
py
Accepted
10
4212
179
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin a, b = (int(s) for s in stdin.readline().split()) while b: a, b = b, a % b print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,178
s465842351
p02256
u140201022
1382539850
Python
Python
py
Accepted
20
4580
274
#!/usr/bin/env python # -*- coding:utf-8 -*- from __future__ import print_function import time import sys import io import re import math #start = time.clock() #h,i = 497,284 h,i=map(int, raw_input().split()) while i != 0: siki= h % i h = i i = siki print (h)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,179
s002411228
p02256
u266872031
1385396341
Python
Python
py
Accepted
20
4200
119
A=map(int,raw_input().split()) A.sort() while A[1]%A[0]!=0: temp=A[0] A[0]=A[1]%A[0] A[1]=temp print A[0]
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,180
s228419564
p02256
u231998559
1387350599
Python
Python
py
Accepted
10
4200
133
x, y = map(int, raw_input().split()) if x < y: x, y = y, x while True: a = x % y if a == 0: print y break else: x, y = y, a
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
32,181