結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー sangonanasangonana
提出日時 2021-04-15 21:38:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 8,692 KB
最終ジャッジ日時 2023-09-14 23:39:37
合計ジャッジ時間 1,385 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,596 KB
testcase_01 AC 18 ms
8,692 KB
testcase_02 AC 18 ms
8,600 KB
testcase_03 AC 18 ms
8,664 KB
testcase_04 AC 18 ms
8,588 KB
testcase_05 AC 18 ms
8,628 KB
testcase_06 AC 18 ms
8,652 KB
testcase_07 AC 20 ms
8,512 KB
testcase_08 AC 18 ms
8,540 KB
testcase_09 AC 19 ms
8,548 KB
testcase_10 AC 18 ms
8,648 KB
testcase_11 AC 18 ms
8,472 KB
testcase_12 AC 19 ms
8,644 KB
testcase_13 AC 19 ms
8,472 KB
testcase_14 AC 19 ms
8,464 KB
testcase_15 AC 18 ms
8,512 KB
testcase_16 AC 18 ms
8,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n=int(input())
def prime_list(x):
	i=2
	prime=defaultdict(int)
	while i*i<=x:
		while x%i==0:
			x//=i
			prime[i]+=1
		i+=1
	if x>1:
		prime[x]+=1
	return prime

p=prime_list(n)
ans1=1
ans2=1
for x in p:
	if p[x]%2==1:
		ans1*=x
	ans2*=x**(p[x]//2)
print(ans2,ans1)
0