結果
問題 | No.2954 Calculation of Exponentiation |
ユーザー |
![]() |
提出日時 | 2024-11-09 03:15:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 591 bytes |
コンパイル時間 | 1,959 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 59,392 KB |
最終ジャッジ日時 | 2024-11-09 03:15:35 |
合計ジャッジ時間 | 3,313 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
from collections import defaultdictdef Factorize(N):assert N>=1factors=defaultdict(int)for p in range(2,N):if p**2>N:breakwhile N%p==0:factors[p]+=1N//=pif N!=1:factors[N]+=1return factorsA,B=map(float,input().split())A=round(A*10000)B=round(B*10000)x,y=A,10000if B<0:B=-Bx,y=y,xcnt=defaultdict(int)for p,e in Factorize(x).items():cnt[p]+=e*Bfor p,e in Factorize(y).items():cnt[p]-=e*Bans="Yes"for p,e in cnt.items():if e%10000 or e<0:ans="No"print(ans)