結果

問題 No.1113 二つの整数 / Two Integers
ユーザー Theta
提出日時 2022-10-20 10:56:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 592 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-06-30 04:58:51
合計ジャッジ時間 1,406 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import floor, sqrt


def gcd(*numbers: int) -> int:
    if len(numbers) == 1:
        return numbers[0]
    if len(numbers) == 2:
        a, b = numbers
        if a < b:
            a, b = b, a

        while True:

            if a % b == 0:
                return b
            a, b = b, a % b

    first_gcd = gcd(*numbers[:2])
    return gcd(first_gcd, *numbers[2:])


def main():
    A, B = map(int, input().split())
    AB_gcd = gcd(A, B)
    if floor(sqrt(AB_gcd)) ** 2 == AB_gcd:
        print("Odd")
    else:
        print("Even")


if __name__ == "__main__":
    main()
0