結果
問題 |
No.537 ユーザーID
|
ユーザー |
![]() |
提出日時 | 2025-03-20 18:48:09 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 999 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 82,528 KB |
実行使用メモリ | 62,052 KB |
最終ジャッジ日時 | 2025-03-20 18:49:44 |
合計ジャッジ時間 | 2,961 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 13 |
ソースコード
import math def factorize(n): factors = {} i = 2 while i * i <= n: while n % i == 0: factors[i] = factors.get(i, 0) + 1 n = n // i i += 1 if n > 1: factors[n] = 1 return factors def generate_divisors(factors): divisors = [1] for prime, exp in factors.items(): current_powers = [prime**e for e in range(exp + 1)] new_divisors = [] for d in divisors: for pow_val in current_powers: new_divisors.append(d * pow_val) divisors = new_divisors divisors = sorted(divisors) return divisors n = int(input()) if n == 0: print(0) else: factors = factorize(n) divisors = generate_divisors(factors) sqrt_n = math.isqrt(n) ans = 0 for a in divisors: if a > sqrt_n: break b = n // a if a * b != n: continue if a == b: ans += 1 else: ans += 2 print(ans)