結果

問題 No.278 連続する整数の和(2)
ユーザー 👑 rin204rin204
提出日時 2020-08-19 23:17:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 10,476 KB
実行使用メモリ 8,016 KB
最終ジャッジ日時 2023-08-02 13:18:02
合計ジャッジ時間 2,789 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 15 ms
7,936 KB
testcase_02 AC 157 ms
7,920 KB
testcase_03 AC 15 ms
7,860 KB
testcase_04 AC 15 ms
7,908 KB
testcase_05 AC 17 ms
7,904 KB
testcase_06 AC 19 ms
7,956 KB
testcase_07 AC 19 ms
7,920 KB
testcase_08 AC 145 ms
7,892 KB
testcase_09 AC 146 ms
7,892 KB
testcase_10 AC 190 ms
7,864 KB
testcase_11 AC 151 ms
7,888 KB
testcase_12 AC 16 ms
8,016 KB
testcase_13 AC 124 ms
7,868 KB
testcase_14 AC 98 ms
7,860 KB
testcase_15 AC 112 ms
7,924 KB
testcase_16 AC 91 ms
8,016 KB
testcase_17 AC 152 ms
8,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

n = int(input())
n2 = n * (n - 1) // 2
x = gcd(n, n2)
ans = 0
for i in range(1, int(x ** 0.5) + 1):
    if x % i == 0:
        ans += i
        ans += x // i
        if x == i ** 2:
            ans -= i
print(ans)
0