結果

問題 No.2954 Calculation of Exponentiation
ユーザー のーと
提出日時 2024-11-08 23:20:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 63,616 KB
最終ジャッジ日時 2024-11-08 23:20:34
合計ジャッジ時間 5,475 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 5 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B=map(float,input().split())
import math
ga=math.gcd(int(10000*A),10000)
gb=math.gcd(int(10000*B),10000)
p=int(10000*A)//ga
q=10000//ga
r=int(10000*B)//gb
s=10000//gb

#print(p,q,r,s)
M=998244353
f=0
for n in range(10000000):
	if pow(n,s,M)==p:
		y=n
		f+=1
		break
	if pow(n,s,M)>p:
		print("No")
		exit()

for n in range(10000000):
	if pow(n,s,M)==q:
		x=n
		f+=1
		break
	if pow(n,s,M)>q:
		print("No")
		exit()
#print(y,x)
if f<2:
	print("No")
	exit()
	
if y%x==0:
	print("Yes")
else:
	print("No")
0