結果

問題 No.2954 Calculation of Exponentiation
コンテスト
ユーザー detteiuu
提出日時 2026-08-16 02:56:48
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 729 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 570 ms
コンパイル使用メモリ 96,100 KB
実行使用メモリ 82,660 KB
最終ジャッジ日時 2026-08-16 02:56:53
合計ジャッジ時間 3,822 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from math import isqrt

def factorization(n):
    arr = []
    temp = n
    for i in range(2, isqrt(n)+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])
    if arr == []:
        arr.append([n, 1])
    return arr

A, B = input().split()

A, B = int(A[:-5]+A[-4:]), int(B[:-5]+B[-4:])
fact = factorization(A)

cnt = 0
for n, c in fact:
    if n == 1: continue
    if n == 2 or n == 5:
        c -= 4
        cnt += 1
    if c*B < 0:
        print("No")
        break
    if c*B%10000 != 0:
        print("No")
        break
else:
    print("Yes" if cnt == 2 else "No")
0