結果

問題 No.1224 I hate Sqrt Inequality
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-18 06:36:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 772 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 87,392 KB
実行使用メモリ 75,688 KB
最終ジャッジ日時 2023-10-09 10:54:30
合計ジャッジ時間 2,299 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,480 KB
testcase_01 AC 73 ms
71,844 KB
testcase_02 AC 74 ms
71,264 KB
testcase_03 AC 72 ms
71,560 KB
testcase_04 AC 72 ms
71,184 KB
testcase_05 AC 73 ms
71,640 KB
testcase_06 AC 76 ms
75,688 KB
testcase_07 AC 75 ms
71,280 KB
testcase_08 AC 71 ms
71,232 KB
testcase_09 AC 76 ms
75,532 KB
testcase_10 AC 110 ms
75,428 KB
testcase_11 AC 163 ms
75,676 KB
testcase_12 AC 74 ms
71,608 KB
testcase_13 AC 74 ms
71,528 KB
testcase_14 AC 74 ms
71,556 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