結果

問題 No.300 平方数
ユーザー yumechi
提出日時 2015-11-13 23:10:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 628 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,208 KB
最終ジャッジ日時 2024-09-13 15:08:07
合計ジャッジ時間 33,271 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 RE * 13 TLE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt


def getPrimeList(n):
    ps = [2, 3, 5, 7]
    primes = [i for i in ps if n >= i]
    for i  in range(11, n + 1, 2):
        primeflag = True
        for j in primes:
            if j ** 2 > i:
                break
            if i % j == 0:
                primeflag = False
                break
        if primeflag:
            primes.append(i)
    return primes

X = int(input())
res = 1
ps = getPrimeList(int(sqrt(X) + 1))
idx = 0
while X != 1:
    count = 0
    while X % ps[idx] == 0:
        X //= ps[idx]
        count += 1
    if count % 2 == 1:
        res *= ps[idx]
    idx += 1
print(res)
0