結果

問題 No.278 連続する整数の和(2)
ユーザー matsu7874matsu7874
提出日時 2015-10-21 15:49:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 8,524 KB
最終ジャッジ日時 2023-09-29 17:05:23
合計ジャッジ時間 3,058 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,324 KB
testcase_01 WA -
testcase_02 AC 104 ms
8,348 KB
testcase_03 AC 15 ms
8,392 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 17 ms
8,524 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 98 ms
8,368 KB
testcase_10 AC 122 ms
8,364 KB
testcase_11 WA -
testcase_12 AC 15 ms
8,152 KB
testcase_13 WA -
testcase_14 AC 68 ms
8,380 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 100 ms
8,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def get_divisors(n):
    # 約数列挙
    divisors = set()
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.add(i)
            divisors.add(n // i)
    list(divisors)
    return divisors

n = int(input())
if n % 2 == 1:
    print(sum(get_divisors(n)))
    exit()
divisors = [get_divisors(n), get_divisors(n - 1)]
for d in divisors[0]:
    total = 0
    if d * 2 in divisors[0] or d in divisors[1]:
        total += 1
print(total)
0