結果

問題 No.1224 I hate Sqrt Inequality
ユーザー GrayCoderGrayCoder
提出日時 2020-09-11 21:54:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 827 ms / 2,000 ms
コード長 705 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 9,896 KB
最終ジャッジ日時 2023-09-02 14:44:19
合計ジャッジ時間 2,818 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,680 KB
testcase_01 AC 30 ms
9,644 KB
testcase_02 AC 30 ms
9,632 KB
testcase_03 AC 30 ms
9,896 KB
testcase_04 AC 30 ms
9,628 KB
testcase_05 AC 30 ms
9,544 KB
testcase_06 AC 41 ms
9,860 KB
testcase_07 AC 30 ms
9,780 KB
testcase_08 AC 30 ms
9,668 KB
testcase_09 AC 30 ms
9,716 KB
testcase_10 AC 353 ms
9,716 KB
testcase_11 AC 827 ms
9,704 KB
testcase_12 AC 30 ms
9,704 KB
testcase_13 AC 30 ms
9,636 KB
testcase_14 AC 30 ms
9,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction
from sys import stdin


def prime_factors(n):
    ret = []
    apnd = ret.append
    while n >= 4:
        if n % 2:
            break
        else:
            n //= 2
            apnd(2)
    i = 3
    while n >= i * i:
        if n % i:
            i += 2
        else:
            n //= i
            apnd(i)
    apnd(n)
    return ret


def main():
    input = lambda: stdin.readline()[:-1]
    A, B = map(int, input().split())

    x = Fraction(A, B)
    n = prime_factors(x.denominator)

    if n[0] == 1:
        print("No")
        return

    for i in n:
        if i not in (2, 5):
            print("Yes")
            break
    else:
        print("No")


main()
0