結果

問題 No.1260 たくさんの多項式
ユーザー ayaoniayaoni
提出日時 2020-10-27 11:59:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 77,344 KB
最終ジャッジ日時 2023-09-29 03:14:19
合計ジャッジ時間 12,935 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
76,632 KB
testcase_01 AC 84 ms
76,648 KB
testcase_02 AC 84 ms
76,636 KB
testcase_03 AC 87 ms
76,388 KB
testcase_04 AC 83 ms
76,388 KB
testcase_05 AC 82 ms
76,720 KB
testcase_06 AC 84 ms
76,532 KB
testcase_07 AC 86 ms
76,516 KB
testcase_08 AC 82 ms
76,648 KB
testcase_09 AC 84 ms
76,464 KB
testcase_10 AC 84 ms
76,376 KB
testcase_11 AC 83 ms
76,652 KB
testcase_12 AC 84 ms
76,412 KB
testcase_13 AC 88 ms
76,620 KB
testcase_14 AC 86 ms
76,760 KB
testcase_15 AC 86 ms
76,552 KB
testcase_16 AC 85 ms
76,612 KB
testcase_17 AC 87 ms
76,756 KB
testcase_18 AC 84 ms
76,640 KB
testcase_19 AC 84 ms
76,512 KB
testcase_20 AC 246 ms
77,144 KB
testcase_21 AC 128 ms
76,636 KB
testcase_22 AC 225 ms
77,072 KB
testcase_23 AC 197 ms
76,688 KB
testcase_24 AC 202 ms
76,420 KB
testcase_25 AC 174 ms
76,632 KB
testcase_26 AC 191 ms
76,572 KB
testcase_27 AC 171 ms
76,668 KB
testcase_28 AC 244 ms
77,264 KB
testcase_29 AC 199 ms
76,708 KB
testcase_30 AC 156 ms
76,808 KB
testcase_31 AC 199 ms
76,452 KB
testcase_32 AC 200 ms
76,528 KB
testcase_33 AC 179 ms
76,628 KB
testcase_34 AC 234 ms
77,048 KB
testcase_35 AC 150 ms
76,496 KB
testcase_36 AC 143 ms
76,344 KB
testcase_37 AC 201 ms
76,900 KB
testcase_38 AC 211 ms
77,172 KB
testcase_39 AC 237 ms
77,024 KB
testcase_40 AC 197 ms
76,812 KB
testcase_41 AC 226 ms
77,132 KB
testcase_42 AC 190 ms
76,372 KB
testcase_43 AC 231 ms
77,092 KB
testcase_44 AC 177 ms
76,720 KB
testcase_45 AC 175 ms
76,636 KB
testcase_46 AC 167 ms
76,552 KB
testcase_47 AC 189 ms
76,532 KB
testcase_48 AC 105 ms
76,516 KB
testcase_49 AC 159 ms
76,612 KB
testcase_50 AC 121 ms
76,608 KB
testcase_51 AC 234 ms
76,856 KB
testcase_52 AC 137 ms
76,520 KB
testcase_53 AC 153 ms
76,804 KB
testcase_54 AC 241 ms
77,344 KB
testcase_55 AC 248 ms
77,132 KB
testcase_56 AC 158 ms
76,648 KB
testcase_57 AC 194 ms
76,940 KB
testcase_58 AC 155 ms
76,900 KB
testcase_59 AC 197 ms
76,648 KB
testcase_60 AC 246 ms
76,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


N = I()
M = int(N**.5)
mod = 10**9+7

# Nのi進表記の桁和の総和

ans = 0
for i in range(2,M+1):
    a = N
    while a:
        ans += a % i
        a -= a % i
        a //= i
    ans %= mod

# N == q*i+r

for q in range(1,M+1):
    low,high = max(N//(q+1),M),N//q  # low < i <= high
    ans += (N+q)*(high-low)-q*(high*(high+1)//2-low*(low+1)//2)
    ans %= mod

print(ans)
0