結果

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

ソースコード

diff #

from math import*
from collections import*
def pf(n):
 a,f=defaultdict(int),2
 while f*f<=n:
  if n%f:f+=1
  else:a[f]+=1;n//=f
 if n>1:a[n]+=1
 return a
a,b=input().split()
al,ar=map(int,a.split('.'))
bl,br=map(int,b.split('.'))
a=al*10000+ar
ag=gcd(a,10000)
a//=ag
aq=10000//ag
b=bl*10000+br
bg=gcd(b,10000)
b//=bg
bq=10000//bg
if b<0:
  b,bg=bg,-b
if aq==bq==1:
  exit(print('Yes'))
pa=pf(a)
for k,v in pa.items():
  if v*b%bq:
    exit(print('No'))
paq=pf(aq)
for k,v in paq.items():
  if pa[k]<v:
    exit(print('No'))
print('Yes')
0