結果

問題 No.278 連続する整数の和(2)
コンテスト
ユーザー roiti46
提出日時 2015-09-04 23:07:36
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
TLE  
実行時間 -
コード長 564 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,172 ms
コンパイル使用メモリ 80,272 KB
実行使用メモリ 165,712 KB
最終ジャッジ日時 2026-04-02 13:22:44
合計ジャッジ時間 5,575 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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
0