結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー 学ぶマン
提出日時 2025-04-17 21:30:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 81,972 KB
実行使用メモリ 60,564 KB
最終ジャッジ日時 2025-04-17 21:30:42
合計ジャッジ時間 2,255 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
N = int(input())

# 素因数分解
def prime_factorize(n): # O(√n)
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = 1
for k, v in Counter(prime_factorize(N)).items():
    a *= k**(v//2)

b = N//(a*a)
print(a, b)
0