#21335: 測試都AC不知為何NA(python)


kettyhappym2662@gmail.com (Julia Tsai)


a,b=input().split()

a=int(a)

b=int(b)

max=0

if 0<a<2**31 and 0<b<2**31:

    True

while True:

    for i in range(1,a+1):

        if a%i==0 and b%i==0:

            max=i

    break

print(max)

#26834: Re:測試都AC不知為何NA(python)


s810380@go.pymhs.tyc.edu.tw (17.yi_)


a,b=input().split()

a=int(a)

b=int(b)

max=0

if 0<a<2**31 and 0<b<2**31:

    True

while True:

    for i in range(1,a+1):

        if a%i==0 and b%i==0:

            max=i

    break

print(max)

你這會超時,如果不用內建GCD,建議使用輾轉相除法