結果

問題 No.1580 I like Logarithm!
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-07-02 22:48:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 770 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 92,356 KB
最終ジャッジ日時 2023-09-11 23:12:38
合計ジャッジ時間 8,032 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,164 KB
testcase_01 AC 73 ms
71,456 KB
testcase_02 AC 73 ms
71,412 KB
testcase_03 AC 76 ms
71,288 KB
testcase_04 AC 76 ms
71,172 KB
testcase_05 AC 76 ms
71,164 KB
testcase_06 AC 125 ms
81,780 KB
testcase_07 AC 179 ms
91,780 KB
testcase_08 AC 75 ms
71,208 KB
testcase_09 AC 89 ms
76,376 KB
testcase_10 AC 94 ms
76,316 KB
testcase_11 AC 141 ms
85,060 KB
testcase_12 AC 145 ms
86,300 KB
testcase_13 AC 133 ms
84,072 KB
testcase_14 AC 175 ms
91,728 KB
testcase_15 AC 153 ms
87,908 KB
testcase_16 AC 73 ms
71,160 KB
testcase_17 AC 75 ms
71,324 KB
testcase_18 AC 76 ms
71,088 KB
testcase_19 AC 74 ms
71,400 KB
testcase_20 AC 76 ms
71,212 KB
testcase_21 AC 76 ms
71,496 KB
testcase_22 AC 76 ms
71,176 KB
testcase_23 AC 76 ms
71,352 KB
testcase_24 AC 75 ms
71,276 KB
testcase_25 AC 74 ms
71,220 KB
testcase_26 AC 185 ms
91,948 KB
testcase_27 AC 185 ms
91,888 KB
testcase_28 AC 185 ms
92,256 KB
testcase_29 AC 188 ms
91,944 KB
testcase_30 AC 184 ms
92,116 KB
testcase_31 AC 186 ms
91,884 KB
testcase_32 AC 186 ms
91,928 KB
testcase_33 AC 184 ms
92,144 KB
testcase_34 AC 188 ms
91,872 KB
testcase_35 AC 185 ms
91,896 KB
testcase_36 AC 184 ms
91,936 KB
testcase_37 AC 183 ms
91,892 KB
testcase_38 AC 184 ms
91,988 KB
testcase_39 AC 184 ms
91,992 KB
testcase_40 AC 186 ms
91,932 KB
testcase_41 AC 185 ms
92,356 KB
testcase_42 AC 185 ms
92,332 KB
testcase_43 AC 184 ms
92,116 KB
testcase_44 AC 184 ms
92,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.readline
    a = int(input())
    b = list(map(int, list(input())[:-1]))
    ans = 0
    mod = 10 ** 9 + 7
    for i in range(1, len(b)):
        if i != len(b) - 1:
            ans += i * pow(a, i, mod) * (a - 1)
            ans %= mod
        else:
            ans += i * (b[-(i + 1)] - 1) * pow(a, i, mod)
            ans %= mod
    ########関数部分##############
    def Base_n_to_10(X,n):
        out = 0
        for i in range(1,len(str(X))+1):
            out += int(X[-i])*pow(n,(i-1),mod)
            out %= mod
        return out#int out
    ############################
    print((ans + (len(b) - 1) * (Base_n_to_10("".join(list(map(str, b[1:]))), a) + 1)) % mod)
if __name__ == '__main__':
    main()
    
0