結果

問題 No.1580 I like Logarithm!
ユーザー tassei903tassei903
提出日時 2021-07-02 22:20:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 85,252 KB
最終ジャッジ日時 2023-09-11 22:26:25
合計ジャッジ時間 8,697 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,364 KB
testcase_01 AC 72 ms
71,480 KB
testcase_02 AC 71 ms
71,232 KB
testcase_03 AC 74 ms
71,204 KB
testcase_04 AC 74 ms
71,316 KB
testcase_05 AC 73 ms
71,328 KB
testcase_06 AC 138 ms
79,484 KB
testcase_07 AC 202 ms
84,716 KB
testcase_08 AC 74 ms
70,916 KB
testcase_09 AC 87 ms
76,216 KB
testcase_10 AC 97 ms
76,352 KB
testcase_11 AC 154 ms
81,360 KB
testcase_12 AC 161 ms
81,936 KB
testcase_13 AC 143 ms
80,716 KB
testcase_14 AC 197 ms
84,712 KB
testcase_15 AC 170 ms
82,668 KB
testcase_16 AC 72 ms
71,288 KB
testcase_17 AC 71 ms
71,160 KB
testcase_18 AC 72 ms
71,212 KB
testcase_19 AC 72 ms
71,164 KB
testcase_20 AC 69 ms
71,156 KB
testcase_21 AC 74 ms
71,164 KB
testcase_22 AC 71 ms
71,340 KB
testcase_23 AC 74 ms
71,392 KB
testcase_24 AC 71 ms
71,344 KB
testcase_25 AC 73 ms
71,332 KB
testcase_26 AC 200 ms
85,080 KB
testcase_27 AC 204 ms
85,112 KB
testcase_28 AC 205 ms
84,988 KB
testcase_29 AC 203 ms
84,676 KB
testcase_30 AC 204 ms
84,880 KB
testcase_31 AC 203 ms
84,788 KB
testcase_32 AC 203 ms
84,800 KB
testcase_33 AC 207 ms
85,252 KB
testcase_34 AC 206 ms
84,920 KB
testcase_35 AC 208 ms
84,728 KB
testcase_36 AC 203 ms
84,832 KB
testcase_37 AC 205 ms
84,796 KB
testcase_38 AC 204 ms
84,676 KB
testcase_39 AC 207 ms
84,900 KB
testcase_40 AC 207 ms
84,988 KB
testcase_41 AC 206 ms
84,816 KB
testcase_42 AC 206 ms
85,000 KB
testcase_43 AC 208 ms
84,988 KB
testcase_44 AC 206 ms
85,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes")
no = lambda :print("no");No = lambda :print("No")
#######################################################################

a = ni()
b = list(map(int,list(input())))[::-1]
Z = len(b)
ans = 0

p = 10**9+7
for i in range(Z-1):
    ans+=i*(pow(a,i+1,p)-pow(a,i,p))%p
    ans%=p
#print(ans)
ans+=((Z-1)*(b[-1]-1)%p*pow(a,Z-1,p))%p
ans%=p
t = 1
for i in range(Z-1):
    t+=b[i]*pow(a,i,p)
    t%=p
ans+=t*(Z-1)%p
ans%=p
print(ans)
0