結果

問題 No.300 平方数
ユーザー 👑 yumechiyumechi
提出日時 2015-11-13 23:10:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 628 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 11,512 KB
最終ジャッジ日時 2023-10-11 16:27:25
合計ジャッジ時間 29,015 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,928 KB
testcase_01 AC 16 ms
8,000 KB
testcase_02 AC 791 ms
10,188 KB
testcase_03 AC 16 ms
8,008 KB
testcase_04 AC 17 ms
7,908 KB
testcase_05 RE -
testcase_06 AC 17 ms
7,880 KB
testcase_07 AC 17 ms
7,888 KB
testcase_08 AC 16 ms
8,056 KB
testcase_09 AC 17 ms
8,020 KB
testcase_10 AC 16 ms
7,980 KB
testcase_11 AC 16 ms
7,940 KB
testcase_12 AC 21 ms
7,852 KB
testcase_13 TLE -
testcase_14 AC 76 ms
8,668 KB
testcase_15 AC 551 ms
9,864 KB
testcase_16 AC 464 ms
9,464 KB
testcase_17 TLE -
testcase_18 AC 67 ms
8,604 KB
testcase_19 AC 368 ms
9,720 KB
testcase_20 RE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 RE -
testcase_25 TLE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 RE -
testcase_33 RE -
testcase_34 TLE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 775 ms
10,332 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 646 ms
10,212 KB
testcase_43 TLE -
testcase_44 RE -
testcase_45 RE -
権限があれば一括ダウンロードができます

ソースコード

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