結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
76,588 KB
testcase_01 WA -
testcase_02 AC 73 ms
76,676 KB
testcase_03 AC 73 ms
76,832 KB
testcase_04 AC 77 ms
76,536 KB
testcase_05 AC 75 ms
76,588 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 75 ms
76,476 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 74 ms
76,704 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 76 ms
76,680 KB
testcase_16 AC 74 ms
76,552 KB
testcase_17 AC 78 ms
76,544 KB
testcase_18 WA -
testcase_19 AC 74 ms
76,588 KB
testcase_20 AC 213 ms
77,076 KB
testcase_21 WA -
testcase_22 AC 195 ms
77,236 KB
testcase_23 WA -
testcase_24 AC 172 ms
77,044 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 205 ms
77,092 KB
testcase_29 AC 171 ms
77,104 KB
testcase_30 AC 136 ms
77,228 KB
testcase_31 AC 173 ms
77,080 KB
testcase_32 AC 178 ms
77,016 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 129 ms
77,028 KB
testcase_37 WA -
testcase_38 AC 185 ms
77,212 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 196 ms
77,204 KB
testcase_42 AC 178 ms
77,084 KB
testcase_43 AC 210 ms
77,040 KB
testcase_44 AC 161 ms
77,176 KB
testcase_45 WA -
testcase_46 AC 152 ms
77,108 KB
testcase_47 AC 167 ms
77,084 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 114 ms
77,268 KB
testcase_51 WA -
testcase_52 AC 127 ms
77,016 KB
testcase_53 WA -
testcase_54 AC 210 ms
76,928 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 132 ms
77,080 KB
testcase_59 AC 173 ms
77,048 KB
testcase_60 AC 216 ms
77,088 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())

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

    """
    # 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