結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー pete1288998pete1288998
提出日時 2020-06-20 23:51:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,592 KB
実行使用メモリ 8,668 KB
最終ジャッジ日時 2023-09-16 17:54:14
合計ジャッジ時間 1,209 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,580 KB
testcase_01 AC 18 ms
8,424 KB
testcase_02 AC 18 ms
8,668 KB
testcase_03 AC 18 ms
8,628 KB
testcase_04 AC 18 ms
8,544 KB
testcase_05 AC 18 ms
8,576 KB
testcase_06 AC 18 ms
8,548 KB
testcase_07 AC 22 ms
8,660 KB
testcase_08 AC 19 ms
8,544 KB
testcase_09 AC 20 ms
8,516 KB
testcase_10 AC 18 ms
8,580 KB
testcase_11 AC 18 ms
8,616 KB
testcase_12 AC 19 ms
8,560 KB
testcase_13 AC 19 ms
8,604 KB
testcase_14 AC 18 ms
8,504 KB
testcase_15 AC 18 ms
8,584 KB
testcase_16 AC 18 ms
8,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

def prime_decomposition(n):
    i = 2
    table = [1]
    while i*i <= n:
        while n%i == 0:
            n /= i
            table.append(i)
        i += 1
        
    if n > 1:
        table.append(n)
        
    return table

n = int(input())
l = Counter(prime_decomposition(n))

a = 1
b = 1

for k,v in l.items():
    if v > 1:
        a *= (k**(v//2))
        b *= (k**(v%2))
    else:
        b *= k
        
print(int(a),int(b))
0