結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー now4estnow4est
提出日時 2020-05-29 23:55:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 64,768 KB
最終ジャッジ日時 2024-04-24 02:29:11
合計ジャッジ時間 1,436 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,968 KB
testcase_01 WA -
testcase_02 AC 39 ms
51,968 KB
testcase_03 WA -
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 39 ms
57,856 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 42 ms
57,856 KB
testcase_13 AC 41 ms
57,984 KB
testcase_14 AC 42 ms
58,240 KB
testcase_15 AC 38 ms
57,600 KB
testcase_16 AC 39 ms
57,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
# n = 12
n_org = n

def b(l):
    if len(l) == 0:
        return 1
    ans = 1
    for i in l:
        ans *= i[0] ** i[1]
    return ans

fac = []
i = 2
while True:
    if i * i > n_org:
        break

    if n % i == 0:
        ex = 0 # 指数
        while n % i == 0:
            ex += 1
            n /= i
        fac.append((i, ex))
    i += 1

if n != 1:
    fac.append((int(n), 1))

if fac[0][1] % 2 == 0:
    print(int(fac[0][0] ** (fac[0][1] / 2)), b(fac[1:]))
else:
    print(b(fac))

0