結果

問題 No.1556 Power Equality
ユーザー Programmerryoki
提出日時 2021-06-25 22:28:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-25 09:48:17
合計ジャッジ時間 1,104 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

def pf(n, ori):
    num = {}
    for i in range(2, n+1):
        if n <= 1:
            break
        if n % i == 0:
            c = 0
            while n % i==0 and n > 1:
                n //= i
                c += 1
            # print(i, c, ori)
            num[i] = c * ori
    return num

A,B = [int(i) for i in input().split()]
dica = pf(A, B)
dicb = pf(B, A)
# print(dica, dicb)
print("Yes" if dica == dicb else "No")
0