結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー lam6er
提出日時 2025-03-26 15:43:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 81,984 KB
実行使用メモリ 59,468 KB
最終ジャッジ日時 2025-03-26 15:43:38
合計ジャッジ時間 3,717 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorize(n):
    factors = {}
    while n % 2 == 0:
        factors[2] = factors.get(2, 0) + 1
        n = n // 2
    i = 3
    while i * i <= n:
        while n % i == 0:
            factors[i] = factors.get(i, 0) + 1
            n = n // i
        i += 2
    if n > 1:
        factors[n] = 1
    return factors

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

if Y == 1:
    print("Yes")
else:
    y_factors = factorize(Y)
    ok = True
    for p, ey in y_factors.items():
        if X % p != 0:
            ok = False
            break
        # Compute exponent of p in X
        temp = X
        ex = 0
        while temp % p == 0:
            ex += 1
            temp = temp // p
        if ex * A < ey * B:
            ok = False
            break
    print("Yes" if ok else "No")
0