結果
| 問題 | No.1063 ルートの計算 / Sqrt Calculation | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-02-23 00:14:38 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 32 ms / 2,000 ms | 
| コード長 | 403 bytes | 
| コンパイル時間 | 95 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-06-30 23:43:25 | 
| 合計ジャッジ時間 | 1,318 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 14 | 
ソースコード
from collections import defaultdict
n = int(input())
Prime_cnt = defaultdict(int)
while n % 2 == 0:
    Prime_cnt[2] += 1
    n //= 2
f = 3
while f * f <= n:
    while n % f == 0:
        Prime_cnt[f] += 1
        n //= f
    f += 2
if n != 1:
    Prime_cnt[n] += 1
a, b = 1, 1
for prime, cnt in Prime_cnt.items():
    q, r = divmod(cnt, 2)
    a *= pow(prime, q)
    b *= pow(prime, r)
print(a, b)
            
            
            
        