結果

問題 No.278 連続する整数の和(2)
ユーザー mayoko_mayoko_
提出日時 2015-09-04 22:59:32
言語 Python2
(2.7.18)
結果
AC  
実行時間 347 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 6,940 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-02 11:45:09
合計ジャッジ時間 3,152 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,812 KB
testcase_01 AC 9 ms
6,940 KB
testcase_02 AC 207 ms
6,944 KB
testcase_03 AC 9 ms
6,940 KB
testcase_04 AC 9 ms
6,944 KB
testcase_05 AC 12 ms
6,940 KB
testcase_06 AC 15 ms
6,944 KB
testcase_07 AC 15 ms
6,944 KB
testcase_08 AC 347 ms
6,940 KB
testcase_09 AC 194 ms
6,944 KB
testcase_10 AC 247 ms
6,940 KB
testcase_11 AC 333 ms
6,944 KB
testcase_12 AC 9 ms
6,940 KB
testcase_13 AC 288 ms
6,944 KB
testcase_14 AC 127 ms
6,944 KB
testcase_15 AC 246 ms
6,940 KB
testcase_16 AC 195 ms
6,940 KB
testcase_17 AC 199 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(a, b):
    if b==0:
        return a
    else:
        return gcd(b, a%b)

N = input()
g = N*(N-1)/2
p = gcd(g, N)
i = 1
ans = 0
while i*i <= p:
    if p%i == 0:
        ans += i
        if i*i < p:
            ans += p/i
    i += 1

print ans
0