結果
| 問題 |
No.278 連続する整数の和(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-09-04 23:07:36 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 564 bytes |
| コンパイル時間 | 1,564 ms |
| コンパイル使用メモリ | 76,928 KB |
| 実行使用メモリ | 84,096 KB |
| 最終ジャッジ日時 | 2024-07-19 01:40:59 |
| 合計ジャッジ時間 | 6,230 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 TLE * 1 -- * 7 |
ソースコード
from collections import defaultdict
N = int(raw_input())
n = N
i = 2
num1, num2 = defaultdict(int), defaultdict(int)
while i*i <= n:
cnt = 0
while n % i == 0:
n /= i
cnt += 1
if cnt > 0:
num1[i] = cnt
i += 1
if n > 1:
num1[n] = 1
n = N*(N + 1)/2
i = 2
while i*i <= n:
cnt = 0
while n % i == 0:
n /= i
cnt += 1
if cnt > 0:
num2[i] = cnt
i += 1
if n > 1:
num2[n] = 1
ans = 1
for a, p in num1.items():
p = min(p, num2[a])
ans *= (a ** (p + 1) - 1) / (a - 1)
print ans