結果

問題 No.278 連続する整数の和(2)
ユーザー しらっ亭しらっ亭
提出日時 2015-09-05 21:59:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 18,292 KB
最終ジャッジ日時 2023-09-26 09:16:47
合計ジャッジ時間 2,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,800 KB
testcase_01 WA -
testcase_02 AC 156 ms
16,856 KB
testcase_03 AC 16 ms
7,796 KB
testcase_04 AC 15 ms
7,800 KB
testcase_05 AC 18 ms
8,488 KB
testcase_06 AC 19 ms
8,424 KB
testcase_07 AC 19 ms
8,532 KB
testcase_08 WA -
testcase_09 AC 136 ms
15,932 KB
testcase_10 AC 170 ms
18,292 KB
testcase_11 AC 139 ms
15,788 KB
testcase_12 WA -
testcase_13 AC 123 ms
14,656 KB
testcase_14 AC 100 ms
13,336 KB
testcase_15 AC 108 ms
13,964 KB
testcase_16 AC 88 ms
12,708 KB
testcase_17 AC 138 ms
16,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisors(n):
    rt = int(n ** 0.5) + 1
    s = [False] * rt
    s[1] = True
    for x in range(2, rt):
        if n % x == 0:
            s[x] = True
    return (i for i in range(rt) if s[i])


def solve():
    N = int(input())

    g = N if N % 2 else N // 2

    s = 0
    for d in divisors(g):
        s += d
        s += g // d

    print(s)


if __name__ == '__main__':
    solve()
0