結果

問題 No.1224 I hate Sqrt Inequality
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-18 06:36:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 772 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 58,864 KB
最終ジャッジ日時 2024-07-26 18:25:18
合計ジャッジ時間 1,591 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,412 KB
testcase_01 AC 37 ms
52,492 KB
testcase_02 AC 39 ms
54,104 KB
testcase_03 AC 38 ms
53,816 KB
testcase_04 AC 38 ms
52,688 KB
testcase_05 AC 39 ms
52,936 KB
testcase_06 AC 42 ms
58,056 KB
testcase_07 AC 37 ms
52,716 KB
testcase_08 AC 38 ms
53,668 KB
testcase_09 AC 41 ms
58,464 KB
testcase_10 AC 72 ms
58,864 KB
testcase_11 AC 117 ms
58,204 KB
testcase_12 AC 37 ms
52,644 KB
testcase_13 AC 38 ms
52,648 KB
testcase_14 AC 37 ms
52,664 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 n+m==2:
    print('No')
    exit()

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:
        t=sa.pop()
        if 2 == t or 5 == t:
            print('No')
        else:
            print('Yes')
    else:
        print('Yes')
else:
    print('No')
        
    
    
0