結果

問題 No.1113 二つの整数 / Two Integers
ユーザー c-yanc-yan
提出日時 2020-07-17 21:27:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 660 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2024-11-29 21:19:51
合計ジャッジ時間 9,899 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 6 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd


def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result


A, B = map(int, input().split())

X = gcd(A, B)

result = 1
for _, c in prime_factorize(X):
    result *= c + 1

if X % 2 == 0:
    print('Even')
else:
    print('Odd')
0