結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー Fukumoto
提出日時 2020-06-08 18:55:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-26 03:00:22
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def prime(n):
    p = Counter()

    while not n % 2:
        p[2] += 1
        n //= 2
        
    i = 3
    
    while i <= n**0.5:
        while not n % i:
            p[i] += 1
            n //= i
        i += 2
        
    if n > 1: p[n] += 1
    
    return p

def divisor(n):
    res = []
    
    i = 1
    while i*i <= n:
        if not n % i:
            res.append(i)
            if (i*i != n): res.append(n//i)     
        
        i += 1
        
    return res

p = prime(n)

a = 1
b = 1

for key, value in p.items():
    if value % 2: b *= key
    m = value // 2
    if m: a *= key ** m

print(a, b)
0