結果

問題 No.278 連続する整数の和(2)
ユーザー mayoko_mayoko_
提出日時 2015-09-04 22:59:32
言語 Python2
(2.7.18)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 45 ms
コンパイル使用メモリ 6,648 KB
実行使用メモリ 6,164 KB
最終ジャッジ日時 2023-08-24 22:36:01
合計ジャッジ時間 3,644 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,036 KB
testcase_01 AC 11 ms
5,972 KB
testcase_02 AC 227 ms
6,144 KB
testcase_03 AC 11 ms
5,964 KB
testcase_04 AC 11 ms
6,056 KB
testcase_05 AC 15 ms
6,044 KB
testcase_06 AC 17 ms
6,044 KB
testcase_07 AC 17 ms
5,972 KB
testcase_08 AC 376 ms
5,996 KB
testcase_09 AC 201 ms
5,996 KB
testcase_10 AC 255 ms
5,984 KB
testcase_11 AC 364 ms
5,984 KB
testcase_12 AC 12 ms
6,008 KB
testcase_13 AC 311 ms
6,072 KB
testcase_14 AC 132 ms
6,040 KB
testcase_15 AC 269 ms
6,164 KB
testcase_16 AC 214 ms
6,040 KB
testcase_17 AC 206 ms
6,036 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