結果

問題 No.2954 Calculation of Exponentiation
ユーザー rlangevin
提出日時 2024-11-13 20:54:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,608 KB
最終ジャッジ日時 2024-11-13 20:54:11
合計ジャッジ時間 3,009 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    return arr


A, B = input().split()
A1, A2 = A.split(".")
B1, B2 = B.split(".")
A1, A2, B1, B2 = int(A1), int(A2), int(B1), int(B2)

if A2:
    print("No")
    exit()

if B2 == 0:
    print("Yes")
    exit()
    
L = factorization(A1)
for a, v in L:
    if v * (B1 * 10000 + B2) % 10000:
        print("No")
        exit()
        
print("Yes")
0