結果

問題 No.442 和と積
ユーザー ThetaTheta
提出日時 2022-10-24 18:16:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 7,996 KB
最終ジャッジ日時 2023-09-15 19:40:45
合計ジャッジ時間 1,828 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
7,828 KB
testcase_02 AC 15 ms
7,876 KB
testcase_03 AC 15 ms
7,724 KB
testcase_04 WA -
testcase_05 AC 15 ms
7,732 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 16 ms
7,732 KB
testcase_10 WA -
testcase_11 AC 16 ms
7,760 KB
testcase_12 AC 15 ms
7,824 KB
testcase_13 AC 15 ms
7,792 KB
testcase_14 AC 15 ms
7,764 KB
testcase_15 AC 15 ms
7,912 KB
testcase_16 AC 16 ms
7,824 KB
testcase_17 AC 16 ms
7,768 KB
testcase_18 WA -
testcase_19 AC 16 ms
7,764 KB
testcase_20 AC 15 ms
7,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


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)
    print(AB_gcd)


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