結果

問題 No.1580 I like Logarithm!
ユーザー minimumminimum
提出日時 2021-07-02 22:10:59
言語 PyPy3
(7.3.13)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 300 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 79,376 KB
最終ジャッジ日時 2023-09-11 22:11:28
合計ジャッジ時間 7,692 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,372 KB
testcase_01 AC 70 ms
71,492 KB
testcase_02 AC 69 ms
71,356 KB
testcase_03 AC 71 ms
71,200 KB
testcase_04 AC 68 ms
71,200 KB
testcase_05 AC 69 ms
71,300 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 67 ms
71,276 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 69 ms
71,244 KB
testcase_17 AC 69 ms
71,332 KB
testcase_18 AC 71 ms
71,388 KB
testcase_19 AC 71 ms
71,292 KB
testcase_20 AC 70 ms
71,404 KB
testcase_21 AC 70 ms
71,424 KB
testcase_22 AC 70 ms
71,308 KB
testcase_23 AC 71 ms
71,216 KB
testcase_24 AC 70 ms
71,212 KB
testcase_25 AC 68 ms
71,332 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10 ** 9 + 7
a = int(input())
b = int(input())
stb = str(b)
n = len(stb)

b10 = 0
for i in range(n):
    b10 *= a
    b10 += int(stb[i])

ans = 0
for i in range(n - 1):
    ans += i * pow(a, i, mod) * (a - 1)
    ans %= mod
ans = (ans + (n - 1) * (b10 - pow(a, n - 1, mod) + 1)) % mod
print(ans)
0