結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
|
提出日時 | 2015-09-04 22:51:34 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 164 ms / 2,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 6,948 KB |
実行使用メモリ | 6,400 KB |
最終ジャッジ日時 | 2024-12-23 09:00:46 |
合計ジャッジ時間 | 1,422 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
def primefactor(n): res = [] i = 2 while i * i <= n: num = 0 while n % i == 0: num += 1 n /= i if num > 0: res.append((i, num)) i += 1 if n != 1: res.append((n, 1)) return res N = input() fac = [] if N % 2 == 0: fac = primefactor(N / 2) else: fac = primefactor(N) ans = 1 for p, e in fac: ans *= (p ** (e + 1) - 1) / (p - 1) print ans