結果

問題 No.1580 I like Logarithm!
ユーザー ygd.ygd.
提出日時 2021-07-02 21:58:53
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 78,812 KB
最終ジャッジ日時 2023-09-11 21:52:22
合計ジャッジ時間 6,095 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,300 KB
testcase_01 AC 74 ms
71,488 KB
testcase_02 AC 75 ms
71,520 KB
testcase_03 AC 74 ms
70,996 KB
testcase_04 AC 73 ms
71,260 KB
testcase_05 AC 74 ms
71,216 KB
testcase_06 AC 87 ms
77,060 KB
testcase_07 AC 90 ms
78,416 KB
testcase_08 AC 75 ms
71,016 KB
testcase_09 AC 80 ms
76,284 KB
testcase_10 AC 80 ms
76,240 KB
testcase_11 AC 85 ms
77,516 KB
testcase_12 AC 87 ms
77,792 KB
testcase_13 AC 85 ms
77,324 KB
testcase_14 AC 90 ms
78,504 KB
testcase_15 AC 87 ms
78,004 KB
testcase_16 AC 74 ms
71,500 KB
testcase_17 AC 72 ms
71,260 KB
testcase_18 AC 73 ms
71,040 KB
testcase_19 AC 73 ms
71,032 KB
testcase_20 AC 72 ms
71,192 KB
testcase_21 AC 73 ms
71,216 KB
testcase_22 AC 74 ms
71,180 KB
testcase_23 AC 72 ms
71,472 KB
testcase_24 AC 74 ms
71,176 KB
testcase_25 AC 75 ms
71,260 KB
testcase_26 AC 90 ms
78,372 KB
testcase_27 AC 90 ms
78,504 KB
testcase_28 AC 91 ms
78,452 KB
testcase_29 AC 91 ms
78,632 KB
testcase_30 AC 90 ms
78,508 KB
testcase_31 AC 91 ms
78,372 KB
testcase_32 AC 90 ms
78,812 KB
testcase_33 AC 89 ms
78,808 KB
testcase_34 AC 90 ms
78,372 KB
testcase_35 AC 90 ms
78,604 KB
testcase_36 AC 88 ms
78,232 KB
testcase_37 AC 89 ms
78,764 KB
testcase_38 AC 88 ms
78,236 KB
testcase_39 AC 90 ms
78,588 KB
testcase_40 AC 90 ms
78,584 KB
testcase_41 AC 91 ms
78,456 KB
testcase_42 AC 89 ms
78,460 KB
testcase_43 AC 89 ms
78,604 KB
testcase_44 AC 90 ms
78,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    A = int(input()); MOD = pow(10,9) + 7
    B = list(str(input()))
    B = [int(b) for b in B]
    B.reverse()
    N = len(B)
    ans = 0
    powa = 1
    cum = 0
    for i in range(N):
        if i != N-1:
            temp = i*powa*(A-1)%MOD
            cum += powa*B[i]%MOD
            cum %= MOD
        else:
            cum += powa*B[i]%MOD
            temp = i*(cum - powa + 1)%MOD
        #print(i,cum,temp)
        ans += temp
        ans %= MOD
        powa = powa*A%MOD
    print(ans)

if __name__ == '__main__':
    main()
0