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
s374216879
p02256
u417951787
1576747830
Python
Python3
py
Accepted
20
5600
192
def gcd(x,y): if x < y: x1 = x x = y y = x1 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,482
s919471422
p02256
u794140916
1576735075
Python
Python3
py
Accepted
20
5600
204
def gcd(x, y): if x < y: x,y = y,x while y > 0: r = x % y x = y y = r print(x) nums=list(map(int,input().split())) gcd(nums[0], nums[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,483
s628399144
p02256
u341505811
1576624501
Python
Python3
py
Accepted
20
5596
101
def gcd(m,n): return m if n == 0 else gcd(n,m%n) 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,484
s345237099
p02256
u918401227
1576412531
Python
Python3
py
Accepted
20
5608
181
A = [list(map(int, s.split())) for s in open(0)][0] x, y = A[0], A[1] if y > x: l, s = y, x else: l, s = x, y while l % s > 0: m = l % s l = s s = m 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,485
s230692943
p02256
u637097953
1576321028
Python
Python3
py
Accepted
20
5600
168
x, y = map(int, input().split()) def greatest_common_divider(x, y): while y > 0: n = x % y x = y y = n return x print(greatest_common_divider(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,486
s176778192
p02256
u333299212
1576282588
Python
Python3
py
Accepted
20
5652
62
import math a,b=map(int,input().split()) print(math.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,487
s830930689
p02256
u315453522
1576271098
Python
Python3
py
Accepted
20
5600
163
def gcd(a, b): mod = max(a, b) % min(a, b) if mod == 0: print(b) else: gcd(min(a, b), mod) x, y = map(int, input().split()) 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,488
s794013596
p02256
u916736774
1576248445
Python
Python3
py
Accepted
20
5668
785
import sys import math input = sys.stdin.readline def main(): sc = Scan() a, b = sc.intarr() print(gcd(a, b)) def gcd(a, b): a, b = b, a % b if b == 0: return a else: return gcd(a, b) class Scan(): def intarr(self): line = input() array = line.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,489
s609163138
p02256
u123563150
1576238919
Python
Python3
py
Accepted
20
5600
97
a,b=map(int,input().split()) while True: if a<b: b,a=a,b a=a%b if a==0: print(b) exit()
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,490
s890321951
p02256
u212896844
1575966608
Python
Python3
py
Accepted
20
5600
138
def gcd(a, b) : if a < b : a,b = b,a if b == 0 : return a return gcd(b, a%b) 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,491
s314084790
p02256
u225899281
1575862328
Python
Python3
py
Accepted
20
5608
257
X, Y = map(int, input().split()) x = max(X, Y) y = min(X, Y) #計算量問題あり ''' for i in range(y): if(x%(y-i)==0)and(y%(y-i)==0): print(y-i) exit() ''' while x != y: if x > y: x -= y else: y -= x 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,492
s046494819
p02256
u525329683
1575821518
Python
Python3
py
Accepted
50
6960
157
# https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/all/ALDS1_1_B from fractions import gcd a, b = list(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,493
s138520432
p02256
u400765446
1575809658
Python
Python3
py
Accepted
20
5600
213
def main(): x, y = list(map(int, input().split())) if x < y: x, y = y, x n = gcd(x, y) print(n) def gcd(x, y): if y == 0: return x else: return gcd(y, 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,494
s741266539
p02256
u529459816
1575792095
Python
Python3
py
Accepted
20
5600
332
def greatest_common_divisor(a, b): # a 割る b = c あまり d # b 割る d = ... residue = a % b if residue != 0: return greatest_common_divisor(b, residue) return b def main(): a, b = map(int, input().split(" ")) print(greatest_common_divisor(a, b)) 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,495
s822318022
p02256
u793684078
1575778816
Python
Python3
py
Accepted
20
5600
245
def greatest_common_devisor(x, y): if y == 0: return x x, y = y, x % y return greatest_common_devisor(x, y) x, y = map(int, input().split(' ')) if x < y: tmp = x x = y y = tmp print(greatest_common_devisor(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,496
s082876329
p02256
u698652225
1575643513
Python
Python3
py
Accepted
20
5592
68
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,497
s506170765
p02256
u230220367
1575615107
Python
Python3
py
Accepted
20
5592
130
xy = list(map(int, input().split())) x = xy[0] y = xy[1] while y!= 0: xx = y yy = x%y x = xx y = yy 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,498
s137894027
p02256
u235698505
1575530765
Python
Python3
py
Accepted
20
5600
217
inputNum = input().split() x = int(inputNum[0]) y = int(inputNum[1]) def gcd(x, y): if x < y: x, y = y, x if x%y != 0: return gcd(y, x%y) else: return y print(str(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,499
s534763690
p02256
u369455271
1575526346
Python
Python3
py
Accepted
20
5600
145
x, y = map(int, input().split()) if x < y: x, y = y, x while True: r = x % y if r == 0: break x, y = y, r print(int(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,500
s823453515
p02256
u911405251
1575471299
Python
Python3
py
Accepted
20
5600
188
def gcd(x,y): a = max(x,y) b = min(x,y) while a%b!=0: r = a%b a=b b=r return b def main(): x,y = map(int,input().split()) print(gcd(x,y)) 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,501
s580709357
p02256
u123367247
1575337538
Python
Python3
py
Accepted
20
5600
192
x, y = map(int, input().split()) def find_gcd(x, y): if x < y: x, y = y, x if x % y == 0: return y else: return find_gcd(y, x % y) print(find_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,502
s321647297
p02256
u288628876
1575118012
Python
Python3
py
Accepted
20
5652
67
import math a, b = map(int, input().split()) print(math.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,503
s562669241
p02256
u841945203
1575091130
Python
Python3
py
Accepted
20
5600
186
# a / b = Q + r # r = 0 def GCD(a,b): r = a % b if(r == 0): return b else: return GCD(b,r) a,b = map(int,input().split()) ans = GCD(a,b) print(ans)
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,504
s695056997
p02256
u079734924
1574770195
Python
Python3
py
Accepted
20
5656
71
from math import gcd 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,505
s391518477
p02256
u705234550
1574756001
Python
Python3
py
Accepted
20
5592
195
l = list(map(int, input().split())) x = max(l) y = min(l) z = x%y if z == 0: z = x else: while x%y > 0: z = x%y if y > z : x = y y = z else: x = z print(z)
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,506
s666802896
p02256
u085485681
1574688543
Python
Python3
py
Accepted
20
5596
214
def Euklides(m, n): while m % n != 0: tempVal = n n = m % n m = tempVal Euklides(m, n) return n a, b = list(map(int, input().split())) print(Euklides(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,507
s538928581
p02256
u001204484
1574435947
Python
Python3
py
Accepted
20
5668
300
import math def gcd(x, y): if x < y: x, y = y, x while y != 0: x, y = y, x % y return x ''' if y == 0: return x return gcd(y, x % y) ''' if __name__ == '__main__': x, y = list(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,508
s346532637
p02256
u821608651
1574310445
Python
Python3
py
Accepted
20
5608
249
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def gcd(a,b): if b==0:return a return gcd(b,a%b) def main(): x,y = list(map(int, 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,509
s330304854
p02256
u942508230
1573712624
Python
Python3
py
Accepted
20
5600
122
x, y = map(int, input().split()) 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,510
s273351834
p02256
u342549725
1573576630
Python
Python3
py
Accepted
20
5600
167
a,b = map(int,input().split()) x = max(a,b) y = min(a,b) def saidai(x,y): if x%y == 0: return y else: return saidai(y,x%y) print(saidai(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,511
s623125678
p02256
u707745674
1573529234
Python
Python3
py
Accepted
30
5668
81
from math import gcd 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,512
s707423454
p02256
u751076502
1573458100
Python
Python3
py
Accepted
30
5596
266
def Euklides(m, n): while m % n != 0: tempVal = n n = m % n m = tempVal Euklides(m, n) return n n, m = list(map(int, input().split())) if m > n: print(Euklides(m, n)) else: print(Euklides(n, 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,513
s674974803
p02256
u519063141
1573116371
Python
Python3
py
Accepted
20
5656
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,514
s703733453
p02256
u648187042
1573114190
Python
Python3
py
Accepted
30
5668
71
x,y=(int(x) for x in input().split()) import math 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,515
s532331675
p02256
u732073438
1572862198
Python
Python3
py
Accepted
20
5600
130
def gcd(x,y): if y <= 0: return x else: return gcd(y,x%y) 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,516
s512682903
p02256
u793120772
1572783423
Python
Python3
py
Accepted
20
5600
249
x,y=list(map(int,input().split())) def gcd(x,y): if x==1 or y==1: return 1 elif x == 0: return y elif y == 0: return x elif x >=y: return gcd(x%y,y) else: return gcd(y%x,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,517
s603862243
p02256
u297517978
1572500362
Python
Python3
py
Accepted
20
5656
62
import math n,x=map(int,input().split()) print(math.gcd(n,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,518
s085147140
p02256
u383095076
1572428249
Python
Python3
py
Accepted
20
5604
139
x, y = [int(i) for i in input().split()] if x < y: x , y = y, x a = -1 while a != 0: a = x % y 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,519
s675592265
p02256
u504636463
1572411925
Python
Python3
py
Accepted
20
5600
247
def greatestc(a, b): if a < b: a, b = b, a c = a % b while c != 0: a = b b = c c = a % b return b if __name__ == '__main__': a, b = input().split(' ') print(greatestc(int(a), int(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,520
s448708508
p02256
u780342333
1572311536
Python
Python3
py
Accepted
20
5600
186
def gcd(x, y): if x < y: x, y = y, x if x % y == 0: return y else: 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,521
s290275785
p02256
u829695570
1572057987
Python
Python3
py
Accepted
20
5596
192
x = sorted(list(map(int, input().split()))) while True: if x[1] % x[0] == 0: print(x[0]) break else: tmp = x[1] % x[0] x[1] = x[0] x[0] = 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,522
s404178398
p02256
u951519498
1571982484
Python
Python3
py
Accepted
20
5612
230
def gcd( x, y): if x>y: return gcd( x-y, y) elif x<y: return gcd( x, y-x) else: return x def main(): x,y = map(int,input().split()) print(gcd(x,y)) 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,523
s669178019
p02256
u851070389
1571523634
Python
Python3
py
Accepted
20
5604
141
import sys def GCD(a, b): if b == 0: return a return GCD(b, a % b) a, b = list(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,524
s763160090
p02256
u578043650
1570982041
Python
Python3
py
Accepted
20
5600
151
x, y = map(int,input().split()) if x < y: x,y = y,x while y>0: if x < y: x,y = y,x 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,525
s837996542
p02256
u894062759
1570876503
Python
Python3
py
Accepted
20
5600
646
a, b = map(int, input().split()) def gcdOld(x, y): while y != 0: x, y = y, x%y return x, y def gcd(a, b): dividend = max(a, b) divider = min(a, b) if divider == 0: return dividend while dividend % divider != 0: r = dividend % divider dividend = divider ...
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,526
s199347652
p02256
u814680900
1570730040
Python
Python3
py
Accepted
20
5604
206
import sys input = sys.stdin.readline X,Y=map(int,input().split()) def gcd(x,y): if x<y: tmp=x x=y y=tmp if x%y==0: return y 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,527
s094006363
p02256
u177078820
1570641341
Python
Python3
py
Accepted
20
5596
214
a,b=input().split() if a>b: a=int(a) b=int(b) else: x=int(a) a=int(b) b=x while True: ext=a%b if ext==0: gcd=b break else: a=b b=ext 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,528
s236262178
p02256
u386372137
1570588376
Python
Python3
py
Accepted
20
5596
152
x,y=map(int,input().split()) b=1 a=0 if y>x: a=x x=y y=a while b>0: b=x%y if b==0: print(y) break x=y 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,529
s227452470
p02256
u174500606
1570522864
Python
Python3
py
Accepted
20
5604
328
def yuc(a,b): if a>b: if a%b==0: return b else: c=a%b i=yuc(b,c) return i else: if b%a==0: return a else: c=b%a i=yuc(a,c) return i x,y=(int(i) for i in input().split()) f=yuc(x,y) pr...
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,530
s173119875
p02256
u481641204
1570346559
Python
Python3
py
Accepted
20
5600
136
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 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,531
s107005861
p02256
u014618861
1570175571
Python
Python3
py
Accepted
20
5600
99
x,y=map(int,input().split()) def gcd(a,b): while b!=0: a,b=b,a%b return a 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,532
s596455243
p02256
u476418873
1570112493
Python
Python3
py
Accepted
20
5600
143
def Euclid(m,n): if n == 0: return m else: return Euclid(n, m%n) m, n = map(int, input().split()) print(Euclid(m, n))
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,533
s781860365
p02256
u500444410
1570100103
Python
Python3
py
Accepted
20
5600
111
def gcd(a,b): if b==0: return a return gcd(b,a%b) 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,534
s207224442
p02256
u447421429
1570076037
Python
Python3
py
Accepted
20
5600
106
a,b=map(int,input().split()) def gcd(x,y): while y!=0: x,y=y,x%y return x 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,535
s283384397
p02256
u658163678
1570072882
Python
Python3
py
Accepted
20
5664
350
import math def gcd(x, y): if x > y: d = x % y while d != 0: x = y y = d d = x % y return y else: d = y % x while d != 0: y = x x = d d = y % x return x x, y = (int(x) for x in input().sp...
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,536
s933602781
p02256
u405373749
1570072611
Python
Python3
py
Accepted
20
5664
93
import math x,y = (int(i) for i in 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,537
s804534614
p02256
u499771011
1570072383
Python
Python3
py
Accepted
20
5612
229
""" 17D8101031C 杉山 祥吾 ID:keisei334 python """ def gcd(a,b): if a%b==0: return b else: return gcd(b,a%b) x=list(map(int,input().split())) print(gcd(x[0],x[1])) """実行結果 147 105 21 """
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,538
s312632570
p02256
u994057612
1570072350
Python
Python3
py
Accepted
20
5596
75
a,b=(int(x) for x in input().split()) while b!=0: 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,539
s647963424
p02256
u767055917
1570072145
Python
Python3
py
Accepted
20
5656
66
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,540
s043136315
p02256
u238519222
1570072139
Python
Python3
py
Accepted
30
5664
258
import math def gcd(x,y): if x > y: r = x % y while r != 0: x = y y = r r = x % y return y else: r = y % x while r != 0: y = x x = r r = y % x return x x, y = (int(x) for x 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,541
s913208844
p02256
u271489440
1570071574
Python
Python3
py
Accepted
20
5596
101
def gcd(a, b): return b if a % b == 0 else gcd(b, a%b) print(gcd(*list(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,542
s735964398
p02256
u261940473
1570070728
Python
Python3
py
Accepted
20
5600
174
def gcd(x,y): if x%y==0: return y else: return gcd(y,x%y) a,b=map(int,input().split()) if a>=b: x=a y=b else: x=b y=a 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,543
s696877611
p02256
u529561768
1570070328
Python
Python3
py
Accepted
20
5600
144
def gcd(a,b): if(b>a): a,b=b,a while(b>0): a,b=b,a%b print(a) x,y=list(map(int,input().split())) 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,544
s655807911
p02256
u367690536
1570070192
Python
Python3
py
Accepted
20
5660
112
import math x,y=(int(i) for i in input().split()) #print(math.gcd(x,y)) 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,545
s880673629
p02256
u657462090
1570070179
Python
Python3
py
Accepted
20
5600
156
def gcd(x,y): if x<y: x,y=y,x 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,546
s413245809
p02256
u169491531
1570069499
Python
Python3
py
Accepted
20
5600
178
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,547
s366434713
p02256
u236088139
1570069134
Python
Python3
py
Accepted
20
5600
113
a, b = map(int, input().split()) if a < b: a, b = b, a while b > 0: r = a % b a = b b = r 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,548
s456472967
p02256
u537758214
1570068336
Python
Python3
py
Accepted
20
5668
78
from math import gcd 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,549
s850607418
p02256
u800816961
1570014794
Python
Python3
py
Accepted
20
5600
175
def gcd(x, y): if x < y: x, y = y,x 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,550
s028342777
p02256
u083019081
1569998997
Python
Python3
py
Accepted
20
5596
96
a,b=list(map(int,input().split())) r=a%b while r!=0: r=a%b a=b b=r 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,551
s570552232
p02256
u322457988
1569982383
Python
Python3
py
Accepted
30
6288
721
from functools import reduce import operator def factor(a): b = 1 d = [] while b: if a == 2: d.append(a) break for i in range(2, a): if a % i == 0: b = a // i d.append(i) a = b 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,552
s276026420
p02256
u655267413
1569923746
Python
Python3
py
Accepted
20
5600
254
def gcd(x,y): if x<y: z=x x=y y=z while True: if x%y==0: break else: z=x%y x=y y=z return y x,y = map(int,input().split()) answer=gcd(x,y) print(answer)
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,553
s230296095
p02256
u852592538
1569901602
Python
Python3
py
Accepted
20
5600
412
def calc_gcd(a, b): if a < b: (a, b) = (b, a) if b == 0: return a return calc_gcd(b, a%b) x, y = map(int, input().split()) assert 1 <= x and x <= 10000000000, "xは範囲外です" assert 1 <= y and y <= 10000000000, "yは範囲外です" if x == y: print(x) elif x == 0 or y == 0: print(0) else: if...
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,554
s971812304
p02256
u153665391
1569805837
Python
Python3
py
Accepted
20
5600
155
def gcd(x, y): if x < y: x, y = y, x if x % y == 0: return y else: 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,555
s631848196
p02256
u798961710
1569662918
Python
Python3
py
Accepted
20
5600
233
def greatestdivisor(x, y): if y>x: tmp = x x = y y = tmp while y>0 : r = x%y x = y y = r print(x) A=input().split(" ") greatestdivisor(int(A[0]), int(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,556
s479506495
p02256
u647441717
1569402329
Python
Python3
py
Accepted
20
5596
109
m, n = map(int,input().split()) r = m % n while r != 0: m = n n = r r = m % n print(n)
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,557
s502283700
p02256
u448439399
1569353062
Python
Python3
py
Accepted
20
5656
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,558
s294876242
p02256
u621417390
1569284382
Python
Python3
py
Accepted
20
5600
168
def gcd(x, y): if x % y == 0: return y else: return gcd(y, x%y) a, b = map(int, input().split()) if b > a: 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,559
s422575176
p02256
u439083584
1569174873
Python
Python3
py
Accepted
40
6956
71
from fractions import gcd 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,560
s431555769
p02256
u950982677
1569154948
Python
Python3
py
Accepted
20
5600
200
def gcd(x,y): if x < y: temp = y y = x x = temp 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,561
s185109002
p02256
u586920078
1568967091
Python
Python3
py
Accepted
20
5604
117
x, y = (int(x) for x in input().split()) if x < y: x, y = y, x while x % y != 0: 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,562
s079615512
p02256
u183700122
1568452884
Python
Python3
py
Accepted
20
5656
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,563
s614643401
p02256
u526189710
1568429230
Python
Python3
py
Accepted
20
5596
194
s = list(map(int,input().split())) x = s[0] y = s[1] z = x % y while True: if z==0: print(y) break temp = z z = y % z y = temp #print("loop y,z:",y,z)
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,564
s850425795
p02256
u132143472
1568356327
Python
Python3
py
Accepted
30
5604
190
def gcd(a,b): if a == 0: return b if a < b: a,b=b,a #a>=bになった return gcd(a%b,b) inputs=input().split() print(gcd(int(inputs[0]), int(inputs[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,565
s610746951
p02256
u244359727
1568267424
Python
Python3
py
Accepted
20
5600
161
A, B = list(map(int, input().split())) def gcd(a, b): if a < b: a, b = b, a if b == 0: return a return gcd(b, a%b) 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,566
s322450696
p02256
u366363301
1568221413
Python
Python3
py
Accepted
20
5600
144
#coding: utf-8 a, b = map(int, input().split()) x = max(a, b) y = a + b - x while x % y > 0: z = x % y x = y y = z print(str(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,567
s599265183
p02256
u487861672
1568207003
Python
Python3
py
Accepted
20
5604
118
def gcd(x, y): return x if y == 0 else gcd(y, x % y) x, y = [int(x) for x 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,568
s812851424
p02256
u314932236
1568040906
Python
Python3
py
Accepted
30
5600
181
def gcd(x,y): tx, ty = max(x,y), min(x,y) if ty%tx == 0: return tx else: return gcd(tx%ty, ty) def main(): x,y = map(int,input().split()) print(gcd(x,y)) return 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,569
s891785182
p02256
u650018120
1568034812
Python
Python3
py
Accepted
20
5604
377
# coding: utf-8 def greatest_common_devisor(x, y): if x > y: x, y = y, x amari = y % x while amari != 0: y = amari # 大きい方を消して,小さい方を残す if x > y: x, y = y, x amari = y % x print(x) if __name__ == "__main__": x, y = map(int, input().split()) great...
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,570
s964551821
p02256
u647694976
1568014916
Python
Python3
py
Accepted
20
5608
179
"""import math x,y=map(int,input().split()) print(math.gcd(x,y))""" x,y=sorted(list(map(int,input().split()))) r=x while 1: if x%y==0:break r=x%y x=y y=r 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,571
s296256539
p02256
u991321321
1568004256
Python
Python3
py
Accepted
20
5604
152
# 1_1_B_GreatestCommonDivisor.py x, y = [int(i) for i in input().split()] if x < y: x, y = y, x while x % y != 0: 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,572
s477444045
p02256
u003984259
1567950869
Python
Python3
py
Accepted
20
5596
147
def GCD(p,q): if p<q:p,q=q,p if p%q==0: return q else: return GCD(q,p%q) 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,573
s776599176
p02256
u813197825
1567943905
Python
Python3
py
Accepted
20
5600
194
def gcd(a, b): a, b = min(a, b), max(a, b) if a == 0: return 1 if b % a == 0: return a return gcd(b % a, 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,574
s611341440
p02256
u629170852
1567601720
Python
Python3
py
Accepted
20
5600
214
def gc(a,b): while b!=0: a,b=b,a%b return a n=list(map(int,input().split())) if n[0]==n[1]: print(gc(n[0],n[1])) elif n[0]>n[1]: a=n[0]%n[1] print(gc(n[1],a)) else: a=n[1]%n[0] print(gc(n[0],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,575
s056082014
p02256
u773296755
1567525645
Python
Python3
py
Accepted
20
5600
180
a, b = map(int,input().split()) def gcd(x, y): if x < y: x, y = y, x while y > 0: r = x % y x = y y = r return x 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,576
s646411093
p02256
u910017046
1567455617
Python
Python3
py
Accepted
20
5600
257
# ALDS1_1_B - Greatest Common Divisor def gcd(x: int, y: int) -> int: while x % y: x, y = y, x % y return y def main(): A, B = tuple(map(int, input().split())) ans = gcd(A, B) print(ans) 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,577
s688253297
p02256
u661205028
1567414740
Python
Python3
py
Accepted
20
5600
188
def euc(a, b): if a > b: a, b = b, a if a == 0: return b return euc(b%a, a) if __name__ == '__main__': a, b = map(int,input().split()) print(euc(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,578
s257958217
p02256
u405726708
1567261215
Python
Python3
py
Accepted
20
5656
66
import math a,b = map(int, input().split()) print(math.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,579
s899567216
p02256
u603762757
1567154809
Python
Python3
py
Accepted
20
5600
126
x, y = map(int, input().split()) b = max(x, y) s = min(x, y) c = b % s while c != 0: b = s % c b, s, c = s, c, b 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,580
s204210610
p02256
u846497769
1566994268
Python
Python3
py
Accepted
20
5596
114
x, y = map(int,input().split()) if x < y: v = x x = y y = v 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,581