結果

問題 No.300 平方数
ユーザー Konton7Konton7
提出日時 2019-04-28 09:44:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 58 ms / 1,000 ms
コード長 612 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 8,148 KB
最終ジャッジ日時 2023-08-21 09:02:03
合計ジャッジ時間 3,802 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,948 KB
testcase_01 AC 16 ms
7,996 KB
testcase_02 AC 34 ms
7,988 KB
testcase_03 AC 16 ms
7,996 KB
testcase_04 AC 16 ms
7,988 KB
testcase_05 AC 16 ms
8,108 KB
testcase_06 AC 16 ms
7,968 KB
testcase_07 AC 16 ms
8,008 KB
testcase_08 AC 16 ms
7,988 KB
testcase_09 AC 16 ms
7,992 KB
testcase_10 AC 16 ms
8,056 KB
testcase_11 AC 16 ms
7,936 KB
testcase_12 AC 16 ms
8,024 KB
testcase_13 AC 58 ms
7,988 KB
testcase_14 AC 18 ms
8,016 KB
testcase_15 AC 30 ms
8,004 KB
testcase_16 AC 28 ms
8,068 KB
testcase_17 AC 43 ms
7,964 KB
testcase_18 AC 18 ms
7,960 KB
testcase_19 AC 26 ms
7,956 KB
testcase_20 AC 23 ms
7,936 KB
testcase_21 AC 43 ms
8,064 KB
testcase_22 AC 40 ms
7,952 KB
testcase_23 AC 50 ms
7,936 KB
testcase_24 AC 40 ms
7,952 KB
testcase_25 AC 50 ms
8,072 KB
testcase_26 AC 47 ms
8,056 KB
testcase_27 AC 37 ms
7,924 KB
testcase_28 AC 50 ms
7,940 KB
testcase_29 AC 54 ms
8,000 KB
testcase_30 AC 55 ms
7,960 KB
testcase_31 AC 56 ms
8,148 KB
testcase_32 AC 40 ms
7,912 KB
testcase_33 AC 30 ms
7,960 KB
testcase_34 AC 52 ms
8,060 KB
testcase_35 AC 40 ms
8,004 KB
testcase_36 AC 44 ms
7,912 KB
testcase_37 AC 40 ms
7,920 KB
testcase_38 AC 35 ms
7,988 KB
testcase_39 AC 40 ms
8,016 KB
testcase_40 AC 37 ms
7,936 KB
testcase_41 AC 29 ms
7,920 KB
testcase_42 AC 32 ms
7,936 KB
testcase_43 AC 45 ms
8,008 KB
testcase_44 AC 39 ms
8,080 KB
testcase_45 AC 28 ms
8,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())


def  primefactor(a):
    pflist = []

    a_sqrt = math.floor(math.sqrt(a))


    while a % 2 == 0:
        a //= 2 
        pflist.append(2)

    for i in range(3,a_sqrt+1,2):
        while a % i == 0:
            a //= i 
            pflist.append(i)
    
    if a != 1:
        pflist.append(a)

    pflist2 = sorted(list(set(pflist)))
    pflist3 = [ ( i ,  pflist.count(i) ) for i in pflist2 ]
    return pflist3

pflist4 = primefactor(n)


ans = 1

if n != 1:
    for i in range(len(pflist4)):
        if pflist4[i][1] % 2 == 1:
            ans *= pflist4[i][0]

print(ans)
0