結果

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

ソースコード

diff #

def solve(X):
    fact = []
    i = 2
    while i * i <= X:
        cnt = 0
        while X % i == 0:
            cnt += 1
            X /= i
        if cnt > 0:
            fact.append((i, cnt))
        i += 1
    if X > 1:
        fact.append((X, 1))
    res = 1
    for a, p in fact:
        res *= a ** (p % 2)
    return res

X = int(raw_input())
print solve(X)
0