結果

問題 No.300 平方数
ユーザー yuppe19 😺
提出日時 2015-11-17 22:35:45
言語 Python2
(2.7.18)
結果
AC  
実行時間 124 ms / 1,000 ms
コード長 414 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,912 KB
最終ジャッジ日時 2024-09-13 16:54:05
合計ジャッジ時間 2,868 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from collections import defaultdict
from operator import mul

def factorize(n):
    res = defaultdict(int)
    d = 2
    while d * d <= n:
        while n % d == 0:
            res[d] += 1
            n /= d
        d += 1
    if n > 1:
        res[n] += 1
    return res

x = int(raw_input())
filtered = [k for k, v in factorize(x).items() if v & 1] or [1]
res = reduce(mul, filtered)
print res
0