結果

問題 No.2480 Sequence Sum
ユーザー miya145592miya145592
提出日時 2023-09-22 23:21:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 86,660 KB
実行使用メモリ 75,536 KB
最終ジャッジ日時 2023-09-22 23:21:17
合計ジャッジ時間 2,510 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,028 KB
testcase_01 AC 81 ms
71,344 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())
Y = make_divisors(N)
ans = 0
for y in Y:
    tmp = N//y
    if y==1:
        cnt = (tmp+1)//2-1
        #print(cnt)
        if cnt>0:
            ans += cnt
        else:
            break
    else:
        cnt = (tmp+y)//(y+1)-1
        #print(cnt)
        if cnt>0:
            ans += cnt
        else:
            break
print(ans)
0