結果
| 問題 | No.2954 Calculation of Exponentiation |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-08-16 02:56:48 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 729 bytes |
| 記録 | |
| コンパイル時間 | 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 |
ソースコード
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")
detteiuu