結果

問題 No.278 連続する整数の和(2)
ユーザー しらっ亭しらっ亭
提出日時 2015-09-05 21:48:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 412 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 10,644 KB
実行使用メモリ 816,504 KB
最終ジャッジ日時 2023-09-26 09:15:02
合計ジャッジ時間 1,928 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,944 KB
testcase_01 AC 16 ms
7,820 KB
testcase_02 RE -
testcase_03 AC 15 ms
7,872 KB
testcase_04 AC 19 ms
8,456 KB
testcase_05 MLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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


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

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

    print(sum(divisors(g)))


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