結果

問題 No.1276 3枚のカード
ユーザー ayaoniayaoni
提出日時 2020-10-31 01:25:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 912 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 78,200 KB
最終ジャッジ日時 2023-09-29 09:38:26
合計ジャッジ時間 31,395 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,648 KB
testcase_01 AC 69 ms
71,816 KB
testcase_02 AC 70 ms
71,736 KB
testcase_03 AC 70 ms
71,652 KB
testcase_04 AC 73 ms
71,496 KB
testcase_05 AC 68 ms
71,928 KB
testcase_06 AC 69 ms
71,504 KB
testcase_07 AC 69 ms
72,020 KB
testcase_08 AC 69 ms
71,740 KB
testcase_09 AC 70 ms
71,760 KB
testcase_10 AC 783 ms
78,112 KB
testcase_11 AC 426 ms
77,812 KB
testcase_12 AC 512 ms
77,908 KB
testcase_13 AC 529 ms
77,812 KB
testcase_14 AC 140 ms
78,020 KB
testcase_15 AC 447 ms
77,960 KB
testcase_16 AC 841 ms
78,020 KB
testcase_17 AC 509 ms
77,824 KB
testcase_18 AC 403 ms
78,200 KB
testcase_19 AC 592 ms
77,912 KB
testcase_20 AC 388 ms
77,992 KB
testcase_21 AC 401 ms
77,968 KB
testcase_22 AC 864 ms
77,820 KB
testcase_23 AC 133 ms
77,664 KB
testcase_24 AC 566 ms
78,020 KB
testcase_25 AC 257 ms
78,052 KB
testcase_26 AC 675 ms
78,028 KB
testcase_27 AC 764 ms
77,816 KB
testcase_28 AC 736 ms
77,812 KB
testcase_29 AC 467 ms
77,976 KB
testcase_30 AC 172 ms
77,996 KB
testcase_31 AC 133 ms
77,856 KB
testcase_32 AC 267 ms
78,024 KB
testcase_33 AC 109 ms
77,800 KB
testcase_34 AC 216 ms
78,104 KB
testcase_35 AC 212 ms
77,816 KB
testcase_36 AC 108 ms
78,100 KB
testcase_37 AC 203 ms
77,964 KB
testcase_38 AC 168 ms
78,016 KB
testcase_39 AC 280 ms
77,916 KB
testcase_40 AC 823 ms
77,752 KB
testcase_41 AC 695 ms
78,028 KB
testcase_42 AC 748 ms
77,692 KB
testcase_43 AC 662 ms
78,192 KB
testcase_44 AC 901 ms
78,024 KB
testcase_45 AC 825 ms
77,836 KB
testcase_46 AC 826 ms
77,976 KB
testcase_47 AC 695 ms
78,060 KB
testcase_48 AC 675 ms
78,200 KB
testcase_49 AC 752 ms
77,780 KB
testcase_50 AC 817 ms
77,964 KB
testcase_51 AC 719 ms
78,008 KB
testcase_52 AC 628 ms
77,964 KB
testcase_53 AC 719 ms
77,708 KB
testcase_54 AC 814 ms
77,808 KB
testcase_55 AC 654 ms
77,752 KB
testcase_56 AC 633 ms
78,016 KB
testcase_57 AC 783 ms
78,120 KB
testcase_58 AC 813 ms
77,792 KB
testcase_59 AC 724 ms
77,984 KB
testcase_60 AC 912 ms
77,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def I(): return int(sys.stdin.readline().rstrip())


N = I()
mod = 10**9+7

if N == 3:
    print(0)
    exit()


def f(M):  # (1の約数の個数) + … + (Mの約数の個数)、つまり M//1 + … + M//M
    if M == 0:
        return 0
    res = 0
    for i in range(1,int(M**.5)+1):
        res += M//i
        res %= mod
    res *= 2
    res %= mod
    res -= int(M**.5)**2
    res %= mod
    return res


ans = 0
for x in range(2,int(N**.5)+1):
    y = N//(x+1)
    z = N//x
    ans += (x-1)*(N+1-x)*(z-y)
    ans %= mod
    ans -= (x-1)*(f(z)-f(y))
    ans %= mod

for b in range(1,y+1):
    ans += ((N//b)-1)*(N+1-(N//b)-f(b)+f(b-1))
    ans %= mod

print(ans)
0