結果
| 問題 | No.1063 ルートの計算 / Sqrt Calculation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-23 00:14:38 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 2,000 ms |
| コード長 | 403 bytes |
| 記録 | |
| コンパイル時間 | 428 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-03-21 13:11:55 |
| 合計ジャッジ時間 | 2,653 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)