結果

問題 No.300 平方数
コンテスト
ユーザー lloyz
提出日時 2023-03-04 21:11:03
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 82 ms / 1,000 ms
+ 777µs
コード長 322 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 270 ms
コンパイル使用メモリ 95,720 KB
実行使用メモリ 83,712 KB
最終ジャッジ日時 2026-08-29 22:42:18
合計ジャッジ時間 6,273 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)
0