結果

問題 No.300 平方数
ユーザー kichirb3kichirb3
提出日時 2018-03-24 23:44:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 102 ms / 1,000 ms
コード長 692 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 8,892 KB
最終ジャッジ日時 2023-09-07 09:00:45
合計ジャッジ時間 4,211 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,780 KB
testcase_01 AC 20 ms
8,764 KB
testcase_02 AC 58 ms
8,784 KB
testcase_03 AC 19 ms
8,504 KB
testcase_04 AC 19 ms
8,788 KB
testcase_05 AC 19 ms
8,788 KB
testcase_06 AC 19 ms
8,848 KB
testcase_07 AC 20 ms
8,832 KB
testcase_08 AC 19 ms
8,736 KB
testcase_09 AC 19 ms
8,836 KB
testcase_10 AC 19 ms
8,668 KB
testcase_11 AC 19 ms
8,764 KB
testcase_12 AC 20 ms
8,708 KB
testcase_13 AC 102 ms
8,668 KB
testcase_14 AC 24 ms
8,708 KB
testcase_15 AC 46 ms
8,892 KB
testcase_16 AC 43 ms
8,712 KB
testcase_17 AC 73 ms
8,820 KB
testcase_18 AC 23 ms
8,832 KB
testcase_19 AC 39 ms
8,788 KB
testcase_20 AC 33 ms
8,744 KB
testcase_21 AC 73 ms
8,744 KB
testcase_22 AC 66 ms
8,760 KB
testcase_23 AC 87 ms
8,712 KB
testcase_24 AC 66 ms
8,748 KB
testcase_25 AC 85 ms
8,764 KB
testcase_26 AC 79 ms
8,712 KB
testcase_27 AC 62 ms
8,828 KB
testcase_28 AC 84 ms
8,824 KB
testcase_29 AC 94 ms
8,704 KB
testcase_30 AC 95 ms
8,752 KB
testcase_31 AC 98 ms
8,716 KB
testcase_32 AC 68 ms
8,764 KB
testcase_33 AC 46 ms
8,892 KB
testcase_34 AC 92 ms
8,668 KB
testcase_35 AC 67 ms
8,784 KB
testcase_36 AC 76 ms
8,664 KB
testcase_37 AC 66 ms
8,708 KB
testcase_38 AC 55 ms
8,664 KB
testcase_39 AC 65 ms
8,820 KB
testcase_40 AC 61 ms
8,712 KB
testcase_41 AC 44 ms
8,892 KB
testcase_42 AC 51 ms
8,704 KB
testcase_43 AC 75 ms
8,668 KB
testcase_44 AC 64 ms
8,696 KB
testcase_45 AC 42 ms
8,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.300 平方数
https://yukicoder.me/problems/no/300

"""
import sys
from sys import stdin
from collections import Counter
input = stdin.readline


def calc_divisors(N):
    divisors = []
    for i in range(2, int(N**0.5)+1):
        while N % i == 0:
            divisors.append(i)
            N //= i
    if N != 1:
        divisors.append(N)

    return divisors


def solve(X):
    divisors = calc_divisors(X)
    ans = 1
    for v, fre in Counter(divisors).most_common():
        if fre % 2 == 1:
            ans *= v
    return ans


def main(args):
    X = int(input())
    ans = solve(X)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
0