結果
| 問題 |
No.300 平方数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-04 21:11:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 1,000 ms |
| コード長 | 322 bytes |
| コンパイル時間 | 202 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 59,392 KB |
| 最終ジャッジ日時 | 2024-09-18 01:26:20 |
| 合計ジャッジ時間 | 3,811 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
from collections import defaultdict
x = int(input())
d = defaultdict(int)
while x % 2 == 0:
x //= 2
d[2] += 1
f = 3
while f * f <= x:
while x % f == 0:
x //= f
d[f] += 1
f += 2
if x != 1:
d[x] += 1
ans = 1
for val, cnt in d.items():
if cnt % 2 == 1:
ans *= val
print(ans)