結果

問題 No.1260 たくさんの多項式
ユーザー mkawa2mkawa2
提出日時 2021-08-26 16:57:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 996 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 76,744 KB
最終ジャッジ日時 2023-08-11 16:45:59
合計ジャッジ時間 13,458 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
76,160 KB
testcase_01 AC 86 ms
75,960 KB
testcase_02 AC 87 ms
76,140 KB
testcase_03 AC 87 ms
76,276 KB
testcase_04 AC 86 ms
75,900 KB
testcase_05 AC 89 ms
76,024 KB
testcase_06 AC 88 ms
76,028 KB
testcase_07 AC 88 ms
76,196 KB
testcase_08 AC 88 ms
76,076 KB
testcase_09 AC 87 ms
75,984 KB
testcase_10 AC 87 ms
76,144 KB
testcase_11 AC 87 ms
76,052 KB
testcase_12 AC 88 ms
76,144 KB
testcase_13 AC 88 ms
76,140 KB
testcase_14 AC 87 ms
76,048 KB
testcase_15 AC 87 ms
75,988 KB
testcase_16 AC 87 ms
75,920 KB
testcase_17 AC 89 ms
75,984 KB
testcase_18 AC 88 ms
75,988 KB
testcase_19 AC 87 ms
75,988 KB
testcase_20 AC 271 ms
76,416 KB
testcase_21 AC 138 ms
76,496 KB
testcase_22 AC 247 ms
76,360 KB
testcase_23 AC 217 ms
76,388 KB
testcase_24 AC 223 ms
76,616 KB
testcase_25 AC 191 ms
76,616 KB
testcase_26 AC 216 ms
76,320 KB
testcase_27 AC 190 ms
76,460 KB
testcase_28 AC 265 ms
76,740 KB
testcase_29 AC 219 ms
76,348 KB
testcase_30 AC 168 ms
76,636 KB
testcase_31 AC 217 ms
76,576 KB
testcase_32 AC 223 ms
76,408 KB
testcase_33 AC 196 ms
76,436 KB
testcase_34 AC 258 ms
76,464 KB
testcase_35 AC 163 ms
76,440 KB
testcase_36 AC 157 ms
76,556 KB
testcase_37 AC 220 ms
76,496 KB
testcase_38 AC 235 ms
76,368 KB
testcase_39 AC 260 ms
76,744 KB
testcase_40 AC 218 ms
76,496 KB
testcase_41 AC 252 ms
76,348 KB
testcase_42 AC 212 ms
76,540 KB
testcase_43 AC 260 ms
76,452 KB
testcase_44 AC 198 ms
76,564 KB
testcase_45 AC 198 ms
76,560 KB
testcase_46 AC 183 ms
76,352 KB
testcase_47 AC 210 ms
76,436 KB
testcase_48 AC 112 ms
76,352 KB
testcase_49 AC 177 ms
76,580 KB
testcase_50 AC 136 ms
76,292 KB
testcase_51 AC 257 ms
76,444 KB
testcase_52 AC 145 ms
76,384 KB
testcase_53 AC 167 ms
76,368 KB
testcase_54 AC 266 ms
76,508 KB
testcase_55 AC 273 ms
76,384 KB
testcase_56 AC 172 ms
76,576 KB
testcase_57 AC 213 ms
76,508 KB
testcase_58 AC 163 ms
76,432 KB
testcase_59 AC 216 ms
76,444 KB
testcase_60 AC 272 ms
76,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**9
# md = 998244353
md = 10**9+7

def base(b):
    res = 0
    a = n
    while a:
        a, r = divmod(a, b)
        res += r
    return res

n = II()

ans = 0
last = -1
for b in range(2, n+1):
    last = b
    if b**2 > n: break
    ans += base(b)
    ans %= md

for p in range(n//last, 0, -1):
    l, r = n//(p+1), n//p
    m = r-l
    a = n-p*r
    ans += p*m%md+(2*a+(m-1)*p)*m//2%md
    ans %= md

print(ans)
0