結果
問題 | No.1063 ルートの計算 / Sqrt Calculation |
ユーザー | mesame3993 |
提出日時 | 2021-11-18 14:55:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 552 bytes |
コンパイル時間 | 329 ms |
コンパイル使用メモリ | 87,192 KB |
実行使用メモリ | 76,052 KB |
最終ジャッジ日時 | 2023-08-27 00:46:32 |
合計ジャッジ時間 | 3,048 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,744 KB |
testcase_01 | AC | 72 ms
71,360 KB |
testcase_02 | AC | 71 ms
71,752 KB |
testcase_03 | AC | 79 ms
75,720 KB |
testcase_04 | AC | 71 ms
71,316 KB |
testcase_05 | AC | 75 ms
75,664 KB |
testcase_06 | AC | 74 ms
75,488 KB |
testcase_07 | AC | 75 ms
75,784 KB |
testcase_08 | AC | 76 ms
75,652 KB |
testcase_09 | AC | 77 ms
75,708 KB |
testcase_10 | AC | 76 ms
75,704 KB |
testcase_11 | AC | 75 ms
75,700 KB |
testcase_12 | AC | 75 ms
75,568 KB |
testcase_13 | AC | 76 ms
75,792 KB |
testcase_14 | AC | 77 ms
76,052 KB |
testcase_15 | AC | 77 ms
75,700 KB |
testcase_16 | AC | 76 ms
75,644 KB |
ソースコード
def factorization(n): arr, tmp = [], n for i in range(2, int(-(-n**0.5//1))+1): if tmp % i == 0: cnt = 0 while tmp % i == 0: cnt += 1 tmp //= i arr.append([i, cnt]) if tmp != 1: arr.append([tmp, 1]) if len(arr) == 0: arr.append([n, 1]) return arr def main(): from sys import stdin readline=stdin.readline n = int(readline()) arr = factorization(n) a, b = 1, 1 for i in arr: if i[1] % 2 == 1: b *= i[0] if i[1]//2 != 0: a *= i[0] ** (i[1]//2) print(a, b) main()