結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー wolgnikwolgnik
提出日時 2020-05-29 21:26:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 59,136 KB
最終ジャッジ日時 2024-04-23 20:08:24
合計ジャッジ時間 1,525 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
53,376 KB
testcase_01 AC 45 ms
53,376 KB
testcase_02 AC 43 ms
53,120 KB
testcase_03 AC 42 ms
53,376 KB
testcase_04 AC 43 ms
53,120 KB
testcase_05 AC 42 ms
53,120 KB
testcase_06 AC 43 ms
53,120 KB
testcase_07 AC 48 ms
58,880 KB
testcase_08 AC 46 ms
58,880 KB
testcase_09 AC 46 ms
59,008 KB
testcase_10 AC 46 ms
53,504 KB
testcase_11 AC 41 ms
53,632 KB
testcase_12 AC 50 ms
59,008 KB
testcase_13 AC 46 ms
59,008 KB
testcase_14 AC 46 ms
59,136 KB
testcase_15 AC 42 ms
53,632 KB
testcase_16 AC 42 ms
53,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import Counter
input = sys.stdin.readline
N = int(input())
c = Counter()
x = 2
while x * x <= N:
  while N % x == 0:
    c[x] += 1
    N //= x
  x += 1
if x > 1: c[N] += 1
resa = 1
resb = 1
for x in c.keys():
  if c[x] >= 2: resa *= x ** (c[x] // 2)
  if c[x] % 2: resb *= x * (c[x] % 2)
print(resa, resb)
0