結果

問題 No.1224 I hate Sqrt Inequality
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-18 06:32:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 57,600 KB
最終ジャッジ日時 2024-05-02 19:18:19
合計ジャッジ時間 1,842 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 46 ms
51,584 KB
testcase_02 WA -
testcase_03 AC 42 ms
52,224 KB
testcase_04 AC 42 ms
51,968 KB
testcase_05 AC 44 ms
51,968 KB
testcase_06 AC 47 ms
57,472 KB
testcase_07 AC 42 ms
51,968 KB
testcase_08 AC 42 ms
51,712 KB
testcase_09 AC 46 ms
57,088 KB
testcase_10 AC 79 ms
57,600 KB
testcase_11 AC 126 ms
57,472 KB
testcase_12 AC 46 ms
51,584 KB
testcase_13 WA -
testcase_14 AC 43 ms
51,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
n,m= map(int,input().split())
def p(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    sa=set(a)
    return sa
g=gcd(n,m)
n//=g
m//=g

if m%n != 0 or n == 1:
    sa=p(m)
    if len(sa) == 2:
        a,b =sorted(list(sa))
        if  a == 2  and b == 5:
            print('No')
        else:
            print('Yes')
    elif len(sa) ==1:
        if 2 or 5 ==sa.pop():
            print('No')
        else:
            print('Yes')
    else:
        print('Yes')
else:
    print('No')
        
    
    
0