結果

問題 No.1580 I like Logarithm!
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-07-02 22:52:45
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 82,804 KB
最終ジャッジ日時 2023-09-11 23:16:26
合計ジャッジ時間 7,559 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,196 KB
testcase_01 AC 75 ms
71,280 KB
testcase_02 AC 75 ms
71,020 KB
testcase_03 AC 75 ms
71,072 KB
testcase_04 AC 76 ms
71,180 KB
testcase_05 AC 75 ms
71,184 KB
testcase_06 AC 116 ms
78,464 KB
testcase_07 AC 165 ms
82,596 KB
testcase_08 AC 75 ms
71,072 KB
testcase_09 AC 87 ms
76,440 KB
testcase_10 AC 91 ms
76,664 KB
testcase_11 AC 133 ms
79,860 KB
testcase_12 AC 137 ms
80,316 KB
testcase_13 AC 126 ms
79,300 KB
testcase_14 AC 161 ms
82,556 KB
testcase_15 AC 145 ms
80,780 KB
testcase_16 AC 74 ms
71,024 KB
testcase_17 AC 76 ms
71,228 KB
testcase_18 AC 75 ms
71,192 KB
testcase_19 AC 73 ms
71,192 KB
testcase_20 AC 74 ms
71,188 KB
testcase_21 AC 75 ms
71,024 KB
testcase_22 AC 74 ms
71,120 KB
testcase_23 AC 74 ms
70,988 KB
testcase_24 AC 75 ms
71,244 KB
testcase_25 AC 73 ms
71,216 KB
testcase_26 AC 166 ms
82,504 KB
testcase_27 AC 168 ms
82,576 KB
testcase_28 AC 166 ms
82,512 KB
testcase_29 AC 165 ms
82,508 KB
testcase_30 AC 165 ms
82,772 KB
testcase_31 AC 166 ms
82,500 KB
testcase_32 AC 167 ms
82,692 KB
testcase_33 AC 168 ms
82,336 KB
testcase_34 AC 167 ms
82,680 KB
testcase_35 AC 167 ms
82,364 KB
testcase_36 AC 166 ms
82,504 KB
testcase_37 AC 169 ms
82,328 KB
testcase_38 AC 165 ms
82,804 KB
testcase_39 AC 166 ms
82,572 KB
testcase_40 AC 167 ms
82,668 KB
testcase_41 AC 166 ms
82,500 KB
testcase_42 AC 167 ms
82,360 KB
testcase_43 AC 164 ms
82,288 KB
testcase_44 AC 165 ms
82,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a=int(input())
b=list(map(int,input()))
mod=10**9+7
ans=0
n=len(b)
for i in range(1,n):
    cnt=(pow(a,i,mod)-pow(a,i-1,mod))%mod
    ans+=(i-1)*cnt
    ans%=mod

x=0
for y in b:
    x=(x*a+y)%mod

ans+=(n-1)*(x-pow(a,n-1,mod)+1)
ans%=mod
print(ans)


0