結果

問題 No.1260 たくさんの多項式
ユーザー tamatotamato
提出日時 2020-10-16 23:24:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 915 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 87,408 KB
実行使用メモリ 77,516 KB
最終ジャッジ日時 2023-09-28 05:32:30
合計ジャッジ時間 12,926 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
76,580 KB
testcase_01 WA -
testcase_02 AC 81 ms
76,608 KB
testcase_03 AC 82 ms
76,712 KB
testcase_04 AC 82 ms
76,516 KB
testcase_05 AC 82 ms
76,656 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 82 ms
76,512 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 82 ms
76,608 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 85 ms
76,592 KB
testcase_16 AC 81 ms
76,552 KB
testcase_17 AC 83 ms
76,524 KB
testcase_18 WA -
testcase_19 AC 83 ms
76,512 KB
testcase_20 AC 254 ms
77,276 KB
testcase_21 WA -
testcase_22 AC 234 ms
77,176 KB
testcase_23 WA -
testcase_24 AC 210 ms
77,276 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 247 ms
77,064 KB
testcase_29 AC 206 ms
77,124 KB
testcase_30 AC 164 ms
77,312 KB
testcase_31 AC 207 ms
77,120 KB
testcase_32 AC 207 ms
77,388 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 151 ms
77,032 KB
testcase_37 WA -
testcase_38 AC 220 ms
77,092 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 239 ms
77,360 KB
testcase_42 AC 195 ms
77,036 KB
testcase_43 AC 242 ms
77,124 KB
testcase_44 AC 190 ms
77,128 KB
testcase_45 WA -
testcase_46 AC 175 ms
77,088 KB
testcase_47 AC 195 ms
77,064 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 129 ms
77,064 KB
testcase_51 WA -
testcase_52 AC 143 ms
76,988 KB
testcase_53 WA -
testcase_54 AC 251 ms
77,116 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 157 ms
77,176 KB
testcase_59 AC 209 ms
77,108 KB
testcase_60 AC 257 ms
77,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    def digit_sum(n, k):
        ret = 0
        while n:
            ret = (ret + n % k)%mod
            n //= k
        return ret

    N = int(input())

    """
    # gutyoku
    ans_ = 0
    for i in range(2, N+1):
        ans_ = (ans_ + digit_sum(N, i))%mod
    print(ans_)
    """


    inv_2 = (mod + 1)//2
    ans = 0
    ii = -1
    for i in range(2, N+1):
        if i * i > N:
            ii = i - 1
            break
        ans = (ans + digit_sum(N, i))%mod
    if ii > 0:
        j_min = ii + 1
        for i in range(ii - 1, 0, -1):
            j_max = N // i
            L = j_max - j_min + 1
            ans = (ans + i * L)%mod
            ans = (ans + (((N - i * j_min) + (N - i * j_max))%mod * (L * inv_2)%mod)%mod)%mod
            j_min = j_max + 1
    print(ans)


if __name__ == '__main__':
    main()
0