結果

問題 No.1063 ルートの計算 / Sqrt Calculation
コンテスト
ユーザー miruca
提出日時 2020-06-17 09:59:20
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 22 ms / 2,000 ms
+ 123µs
コード長 430 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 59 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2026-10-12 07:45:02
合計ジャッジ時間 1,628 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())

# 素因数分解
def prime_factor(n):
    factor = []
    for i in range(2, int(n ** 0.5) + 1):
        while (n % i == 0):
            factor.append(i)
            n //= i
    if n != 1:
        factor.append(n)
    return factor

from collections import Counter

pfact = prime_factor(n)
c = Counter(pfact)

a = 1
diff = 1
for k, v in c.items():
    diff *= pow(k, v // 2)


b = n // (diff ** 2)
print(diff, b)
0