結果

問題 No.278 連続する整数の和(2)
ユーザー niyarinniyarin
提出日時 2016-11-08 20:20:36
言語 Python2
(2.7.18)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 6,640 KB
実行使用メモリ 46,972 KB
最終ジャッジ日時 2023-08-24 22:48:37
合計ジャッジ時間 2,244 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,164 KB
testcase_01 AC 11 ms
6,004 KB
testcase_02 AC 147 ms
40,040 KB
testcase_03 AC 13 ms
6,072 KB
testcase_04 AC 12 ms
6,012 KB
testcase_05 AC 14 ms
6,584 KB
testcase_06 AC 15 ms
6,740 KB
testcase_07 AC 15 ms
6,748 KB
testcase_08 AC 132 ms
37,780 KB
testcase_09 AC 133 ms
37,720 KB
testcase_10 AC 167 ms
46,972 KB
testcase_11 AC 129 ms
36,740 KB
testcase_12 AC 12 ms
6,236 KB
testcase_13 AC 111 ms
32,020 KB
testcase_14 AC 90 ms
26,288 KB
testcase_15 AC 97 ms
28,388 KB
testcase_16 AC 79 ms
23,288 KB
testcase_17 AC 135 ms
38,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import *
N = input()
if N == 1:
    print 1
elif N == 2:
    print 1
else:
    v = N if N%2 else N/2
    ans = 0
    sn = int(sqrt(v))
    for i in range(1,sn+1):
        if v % i == 0:
            if i*i == v:
                ans += i
            else:
                ans += i
                ans += v/i
    print ans



    


0