結果

問題 No.1113 二つの整数 / Two Integers
ユーザー ryo_nryo_n
提出日時 2020-07-17 21:37:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 1,120 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,376 KB
最終ジャッジ日時 2024-11-29 22:18:00
合計ジャッジ時間 18,808 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    A, B = [int(x) for x in input().split()]

    def prime_factorization(n):
        i = 2
        factors = []
        while i * i <= n:
            if n % i:
                i += 1
            else:
                n //= i
                factors.append(i)
        if n > 1:
            factors.append(n)
        return factors



    aprimes = prime_factorization(A)
    bprimes = prime_factorization(B)


    x = []
    for a in aprimes:
        if a in bprimes:
            x.append(a)
            bprimes.remove(a)

    xx = 1
    for xxx in x:
        xx *= xxx

    def make_divisors(n):
        divisors = []
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)

        # divisors.sort()
        return divisors

    xxxx = make_divisors(xx)
    if len(xxxx) % 2 == 0:
        print("Even")
    else:
        print("Odd")


    
    

if __name__ == '__main__':
    main()

0