본문 바로가기
알고리즘/[python] 백준 BOJ

[python] 백준 1850 최대공약수

by Alan_Kim 2023. 2. 24.
728x90
반응형
import sys
input = sys.stdin.readline

a, b= map(int, input().split())

def gcd(a,b):
    if b==0:
        return a
    return gcd(b, a%b)

ans = gcd(a,b)

while ans:
    print(1, end='')
    ans -= 1
728x90
반응형

댓글