結果
| 問題 | No.300 平方数 |
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2023-12-31 19:22:20 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 1,000 ms |
| コード長 | 472 bytes |
| 記録 | |
| コンパイル時間 | 290 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 59,008 KB |
| 最終ジャッジ日時 | 2026-04-14 11:17:44 |
| 合計ジャッジ時間 | 3,784 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
import collections
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
def n_fact(N):
c = collections.Counter(prime_factorize(N))
return c
x = int(input())
ans = 1
for k,v in n_fact(x).items():
if v % 2 == 1:
ans *= k
print(ans)
ntuda