結果

問題 No.1224 I hate Sqrt Inequality
ユーザー akikuakiku
提出日時 2021-11-28 07:33:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 821 ms / 2,000 ms
コード長 746 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 10,816 KB
実行使用メモリ 8,124 KB
最終ジャッジ日時 2023-10-05 01:53:31
合計ジャッジ時間 2,550 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,860 KB
testcase_01 AC 15 ms
7,848 KB
testcase_02 AC 15 ms
8,124 KB
testcase_03 AC 16 ms
7,908 KB
testcase_04 AC 15 ms
7,780 KB
testcase_05 AC 16 ms
7,856 KB
testcase_06 AC 27 ms
7,824 KB
testcase_07 AC 15 ms
7,948 KB
testcase_08 AC 15 ms
7,984 KB
testcase_09 AC 16 ms
7,852 KB
testcase_10 AC 345 ms
7,916 KB
testcase_11 AC 821 ms
7,908 KB
testcase_12 AC 15 ms
7,920 KB
testcase_13 AC 15 ms
8,000 KB
testcase_14 AC 15 ms
7,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# Input #######################################
N, M = list(map(int, input().split()))
# 1 1
# MAIN #######################################

if N % M == 0:
    print("No")
    exit()

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


x = gcd(N, M)

N = N // x
M = M // x


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


x = prime_factorize(M)
x = set(x)

if all([i == 2 or i == 5 for i in x]):
    print("No")
else:
    print("Yes")

# END #######################################
0