結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー akitsugu777akitsugu777
提出日時 2020-12-01 15:28:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-10-11 03:36:16
合計ジャッジ時間 1,478 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,856 KB
testcase_01 AC 15 ms
7,980 KB
testcase_02 AC 15 ms
7,860 KB
testcase_03 AC 17 ms
7,804 KB
testcase_04 AC 16 ms
7,800 KB
testcase_05 AC 20 ms
7,808 KB
testcase_06 AC 15 ms
7,808 KB
testcase_07 AC 19 ms
7,848 KB
testcase_08 AC 17 ms
7,900 KB
testcase_09 AC 18 ms
7,856 KB
testcase_10 AC 18 ms
7,804 KB
testcase_11 AC 17 ms
7,948 KB
testcase_12 AC 18 ms
7,904 KB
testcase_13 AC 18 ms
7,848 KB
testcase_14 AC 18 ms
7,856 KB
testcase_15 AC 15 ms
7,852 KB
testcase_16 AC 17 ms
7,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
L = []

for i in range(2, int(N**0.5)+1):
    while N % i == 0:
        L += [i]
        N //= i
if N > 1:
    L += [N]

D = {}
for j in L:
    if not j in D:
        D[j] = 1
    else:
        D[j] += 1

x = 1
y = 1
for k, v in D.items():
    if v % 2 == 0:
        x *= k ** (v//2)
    else:
        x *= k ** (v//2)
        y *= k

print(x, y)
0