結果

問題 No.1224 I hate Sqrt Inequality
ユーザー GrayCoderGrayCoder
提出日時 2020-09-11 21:51:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 650 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 9,820 KB
最終ジャッジ日時 2023-08-27 13:59:21
合計ジャッジ時間 2,639 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,692 KB
testcase_01 AC 30 ms
9,684 KB
testcase_02 WA -
testcase_03 AC 29 ms
9,572 KB
testcase_04 AC 29 ms
9,552 KB
testcase_05 AC 30 ms
9,704 KB
testcase_06 AC 42 ms
9,700 KB
testcase_07 AC 29 ms
9,580 KB
testcase_08 AC 30 ms
9,692 KB
testcase_09 AC 30 ms
9,676 KB
testcase_10 AC 353 ms
9,688 KB
testcase_11 AC 824 ms
9,676 KB
testcase_12 AC 31 ms
9,660 KB
testcase_13 AC 29 ms
9,680 KB
testcase_14 AC 30 ms
9,688 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)
    for i in n:
        if i not in (2, 5):
            print("Yes")
            break
    else:
        print("No")


main()
0