結果

問題 No.300 平方数
ユーザー 双六
提出日時 2019-04-06 00:12:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 506 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2024-06-23 02:53:59
合計ジャッジ時間 4,693 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 1 -- * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

L = [1 for i in range(100001)]
L[0] = 0
L[1] = 0
plist = []
for i in range(100001):
	if L[i] == 1:
		plist.append(i)
		c = 2
		while True:
			if i * c <= 100000:
				L[i * c] = 0
				c += 1
			else:
				break

X = int(input())
D = defaultdict(int)

x = X
judge = "YES"
while judge == "YES":
	for i in plist:
		if x < i:
			judge = "NO"
		else:
			if x % i == 0:
				D[i] += 1
				x = int(x // i)
				break


ans = 1
for i in D:
	if D[i] % 2 == 1:
		ans *= i

print(ans)
0