結果
| 問題 |
No.2954 Calculation of Exponentiation
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-11-09 03:15:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 608 bytes |
| コンパイル時間 | 352 ms |
| コンパイル使用メモリ | 82,368 KB |
| 実行使用メモリ | 66,332 KB |
| 最終ジャッジ日時 | 2024-11-09 03:15:09 |
| 合計ジャッジ時間 | 3,367 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 26 RE * 2 |
ソースコード
from collections import defaultdict
def Factorize(N):
assert N>=1
factors=defaultdict(int)
for p in range(2,N):
if p**2>N:
break
while N%p==0:
factors[p]+=1
N//=p
if N!=1:
factors[N]+=1
return factors
A,B=map(float,input().split())
A=round(A*10000)
B=round(B*10000)
x,y=A,10000
if B<0:
B=-B
x,y=y,x
(x/y)**(B/10000)
cnt=defaultdict(int)
for p,e in Factorize(x).items():
cnt[p]+=e*B
for p,e in Factorize(y).items():
cnt[p]-=e*B
ans="Yes"
for p,e in cnt.items():
if e%10000 or e<0:
ans="No"
print(ans)
vwxyz