結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー ThetaTheta
提出日時 2022-10-26 19:18:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 911 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 8,296 KB
最終ジャッジ日時 2023-09-17 12:15:03
合計ジャッジ時間 4,811 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,244 KB
testcase_01 AC 17 ms
8,112 KB
testcase_02 AC 17 ms
8,080 KB
testcase_03 AC 22 ms
8,148 KB
testcase_04 AC 153 ms
8,144 KB
testcase_05 AC 54 ms
8,296 KB
testcase_06 AC 24 ms
8,220 KB
testcase_07 AC 17 ms
8,168 KB
testcase_08 AC 49 ms
8,216 KB
testcase_09 AC 19 ms
8,124 KB
testcase_10 AC 59 ms
8,228 KB
testcase_11 AC 17 ms
8,224 KB
testcase_12 AC 25 ms
8,108 KB
testcase_13 AC 16 ms
8,128 KB
testcase_14 AC 19 ms
8,172 KB
testcase_15 AC 218 ms
8,076 KB
testcase_16 AC 66 ms
8,200 KB
testcase_17 AC 237 ms
8,168 KB
testcase_18 AC 116 ms
8,168 KB
testcase_19 AC 78 ms
8,228 KB
testcase_20 AC 43 ms
8,272 KB
testcase_21 AC 126 ms
8,108 KB
testcase_22 AC 50 ms
8,128 KB
testcase_23 AC 66 ms
8,096 KB
testcase_24 AC 19 ms
8,148 KB
testcase_25 AC 124 ms
8,220 KB
testcase_26 AC 41 ms
8,148 KB
testcase_27 AC 18 ms
8,184 KB
testcase_28 AC 143 ms
8,216 KB
testcase_29 AC 110 ms
8,104 KB
testcase_30 AC 210 ms
8,228 KB
testcase_31 AC 105 ms
8,204 KB
testcase_32 AC 39 ms
8,264 KB
testcase_33 AC 16 ms
8,156 KB
testcase_34 AC 16 ms
8,264 KB
testcase_35 AC 16 ms
8,296 KB
testcase_36 AC 312 ms
8,220 KB
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 AC 16 ms
8,148 KB
testcase_41 AC 16 ms
8,224 KB
testcase_42 AC 16 ms
8,176 KB
testcase_43 AC 16 ms
8,152 KB
testcase_44 AC 16 ms
8,104 KB
testcase_45 AC 16 ms
8,232 KB
testcase_46 AC 17 ms
8,264 KB
testcase_47 AC 16 ms
8,220 KB
testcase_48 AC 16 ms
8,112 KB
testcase_49 AC 17 ms
8,248 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())
    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