結果

問題 No.278 連続する整数の和(2)
ユーザー matsu7874
提出日時 2015-10-21 15:49:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-22 11:09:33
合計ジャッジ時間 3,043 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 9
権限があれば一括ダウンロードができます

ソースコード

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