結果

問題 No.278 連続する整数の和(2)
ユーザー rin204rin204
提出日時 2020-08-19 23:17:56
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 64 ms
使用メモリ 8,096 KB
最終ジャッジ日時 2022-12-05 10:52:49
合計ジャッジ時間 2,877 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 14 ms
7,984 KB
testcase_01 AC 13 ms
7,740 KB
testcase_02 AC 171 ms
7,852 KB
testcase_03 AC 14 ms
8,044 KB
testcase_04 AC 14 ms
7,944 KB
testcase_05 AC 16 ms
7,992 KB
testcase_06 AC 17 ms
7,920 KB
testcase_07 AC 17 ms
7,824 KB
testcase_08 AC 166 ms
7,856 KB
testcase_09 AC 160 ms
7,988 KB
testcase_10 AC 204 ms
7,984 KB
testcase_11 AC 152 ms
7,920 KB
testcase_12 AC 14 ms
7,740 KB
testcase_13 AC 132 ms
7,852 KB
testcase_14 AC 109 ms
8,096 KB
testcase_15 AC 114 ms
7,920 KB
testcase_16 AC 93 ms
7,844 KB
testcase_17 AC 160 ms
7,940 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