結果

問題 No.300 平方数
ユーザー mkawa2mkawa2
提出日時 2020-02-06 22:53:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 101 ms / 1,000 ms
コード長 663 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 11,872 KB
実行使用メモリ 10,044 KB
最終ジャッジ日時 2023-10-25 22:42:32
合計ジャッジ時間 3,684 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,044 KB
testcase_01 AC 26 ms
10,044 KB
testcase_02 AC 25 ms
10,044 KB
testcase_03 AC 26 ms
10,044 KB
testcase_04 AC 26 ms
10,044 KB
testcase_05 AC 27 ms
10,044 KB
testcase_06 AC 27 ms
10,044 KB
testcase_07 AC 27 ms
10,044 KB
testcase_08 AC 27 ms
10,044 KB
testcase_09 AC 26 ms
10,044 KB
testcase_10 AC 27 ms
10,044 KB
testcase_11 AC 26 ms
10,044 KB
testcase_12 AC 26 ms
10,044 KB
testcase_13 AC 101 ms
10,044 KB
testcase_14 AC 27 ms
10,044 KB
testcase_15 AC 27 ms
10,044 KB
testcase_16 AC 27 ms
10,044 KB
testcase_17 AC 26 ms
10,044 KB
testcase_18 AC 27 ms
10,044 KB
testcase_19 AC 26 ms
10,044 KB
testcase_20 AC 27 ms
10,044 KB
testcase_21 AC 26 ms
10,044 KB
testcase_22 AC 26 ms
10,044 KB
testcase_23 AC 32 ms
10,044 KB
testcase_24 AC 38 ms
10,044 KB
testcase_25 AC 85 ms
10,044 KB
testcase_26 AC 45 ms
10,044 KB
testcase_27 AC 40 ms
10,044 KB
testcase_28 AC 87 ms
10,044 KB
testcase_29 AC 72 ms
10,044 KB
testcase_30 AC 29 ms
10,044 KB
testcase_31 AC 30 ms
10,044 KB
testcase_32 AC 29 ms
10,044 KB
testcase_33 AC 51 ms
10,044 KB
testcase_34 AC 95 ms
10,044 KB
testcase_35 AC 70 ms
10,044 KB
testcase_36 AC 44 ms
10,044 KB
testcase_37 AC 45 ms
10,044 KB
testcase_38 AC 27 ms
10,044 KB
testcase_39 AC 27 ms
10,044 KB
testcase_40 AC 27 ms
10,044 KB
testcase_41 AC 40 ms
10,044 KB
testcase_42 AC 26 ms
10,044 KB
testcase_43 AC 28 ms
10,044 KB
testcase_44 AC 28 ms
10,044 KB
testcase_45 AC 28 ms
10,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())

def PrimeFactorization(x):
    def plist(x):
        if x < 2: return []
        if x & 1 == 0: return [2] + plist(x // 2)
        for p in range(3, x + 1, 2):
            if x % p == 0: return [p] + plist(x // p)
            if p ** 2 > x: return [x]

    pl = plist(x)
    pp, ee = [], []
    for p in pl:
        if not pp or p != pp[-1]:
            pp += [p]
            ee += [0]
        ee[-1] += 1
    return [(p, e) for p, e in zip(pp, ee)]

def main():
    x=II()
    pe=PrimeFactorization(x)
    ans=1
    for p,e in pe:
        if e%2:ans*=p
    print(ans)

main()
0