結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー FukumotoFukumoto
提出日時 2020-06-08 18:55:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 10,816 KB
実行使用メモリ 8,924 KB
最終ジャッジ日時 2023-08-26 23:19:34
合計ジャッジ時間 1,771 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,828 KB
testcase_01 AC 19 ms
8,724 KB
testcase_02 AC 19 ms
8,540 KB
testcase_03 AC 19 ms
8,540 KB
testcase_04 AC 18 ms
8,520 KB
testcase_05 AC 19 ms
8,832 KB
testcase_06 AC 19 ms
8,888 KB
testcase_07 AC 20 ms
8,848 KB
testcase_08 AC 19 ms
8,748 KB
testcase_09 AC 21 ms
8,860 KB
testcase_10 AC 19 ms
8,924 KB
testcase_11 AC 19 ms
8,788 KB
testcase_12 AC 19 ms
8,816 KB
testcase_13 AC 19 ms
8,756 KB
testcase_14 AC 19 ms
8,800 KB
testcase_15 AC 19 ms
8,812 KB
testcase_16 AC 19 ms
8,744 KB
権限があれば一括ダウンロードができます

ソースコード

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