結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー now4estnow4est
提出日時 2020-05-29 23:56:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 516 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 65,024 KB
最終ジャッジ日時 2024-04-24 02:31:19
合計ジャッジ時間 1,790 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

n = int(input())
# n = 10
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(1, b(fac))

0