結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー ThetaTheta
提出日時 2022-10-26 19:21:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 1,012 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 8,348 KB
最終ジャッジ日時 2023-09-17 12:20:22
合計ジャッジ時間 4,945 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,204 KB
testcase_01 AC 16 ms
8,280 KB
testcase_02 AC 16 ms
8,208 KB
testcase_03 AC 22 ms
8,332 KB
testcase_04 AC 153 ms
8,308 KB
testcase_05 AC 53 ms
8,292 KB
testcase_06 AC 24 ms
8,272 KB
testcase_07 AC 17 ms
8,332 KB
testcase_08 AC 48 ms
8,320 KB
testcase_09 AC 19 ms
8,324 KB
testcase_10 AC 60 ms
8,152 KB
testcase_11 AC 18 ms
8,344 KB
testcase_12 AC 25 ms
8,280 KB
testcase_13 AC 16 ms
8,272 KB
testcase_14 AC 19 ms
8,324 KB
testcase_15 AC 219 ms
8,268 KB
testcase_16 AC 67 ms
8,280 KB
testcase_17 AC 236 ms
8,288 KB
testcase_18 AC 116 ms
8,340 KB
testcase_19 AC 78 ms
8,300 KB
testcase_20 AC 43 ms
8,344 KB
testcase_21 AC 124 ms
8,284 KB
testcase_22 AC 51 ms
8,188 KB
testcase_23 AC 66 ms
8,276 KB
testcase_24 AC 18 ms
8,160 KB
testcase_25 AC 125 ms
8,232 KB
testcase_26 AC 41 ms
8,188 KB
testcase_27 AC 17 ms
8,280 KB
testcase_28 AC 142 ms
8,272 KB
testcase_29 AC 110 ms
8,192 KB
testcase_30 AC 209 ms
8,344 KB
testcase_31 AC 105 ms
8,160 KB
testcase_32 AC 39 ms
8,304 KB
testcase_33 AC 16 ms
8,188 KB
testcase_34 AC 17 ms
8,148 KB
testcase_35 AC 17 ms
8,280 KB
testcase_36 AC 313 ms
8,288 KB
testcase_37 AC 16 ms
8,348 KB
testcase_38 AC 16 ms
8,192 KB
testcase_39 AC 17 ms
8,188 KB
testcase_40 AC 17 ms
8,228 KB
testcase_41 AC 16 ms
8,156 KB
testcase_42 AC 16 ms
8,328 KB
testcase_43 AC 16 ms
8,140 KB
testcase_44 AC 16 ms
8,284 KB
testcase_45 AC 16 ms
8,332 KB
testcase_46 AC 16 ms
8,144 KB
testcase_47 AC 17 ms
8,268 KB
testcase_48 AC 16 ms
8,268 KB
testcase_49 AC 16 ms
8,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import count


def calc_prime_factorize(num: int) -> dict[int, int]:
    if num < 2:
        raise ValueError

    divisors = {}
    for divisor in count(2):
        if divisor ** 2 > num:
            if num != 1:
                divisors[num] = 1
            break
        while num % divisor == 0 and num != 1:
            try:
                divisors[divisor] += 1
            except KeyError:
                divisors[divisor] = 1
            num //= divisor

    return divisors


def main():
    X, A, Y, B = map(int, input().split())
    if Y == 1:
        print("Yes")
        return
    if X == 1:
        print("No")
        return
    X_factors = calc_prime_factorize(X)
    Y_factors = calc_prime_factorize(Y)
    for y_prime, count_ in Y_factors.items():
        if y_prime not in X_factors:
            print("No")
            return

        if X_factors[y_prime]*A < count_ * B:
            print("No")
            return

    print("Yes")


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