結果

問題 No.1086 桁和の桁和2
ユーザー tamato
提出日時 2020-06-25 12:43:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 439 ms / 3,000 ms
コード長 691 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 106,252 KB
最終ジャッジ日時 2024-07-22 18:02:12
合計ジャッジ時間 8,994 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    L = list(map(int, input().split()))
    R = list(map(int, input().split()))
    D = list(map(int, input().split()))

    ans = 1
    inv9 = pow(9, mod-2, mod)
    flg = 1
    prev = 0
    for d, l, r in zip(D, L, R):
        if d == 0:
            if not flg:
                print(0)
                exit()
        else:
            flg = 0
            a = ((pow(10, r, mod) - pow(10, l, mod))%mod * inv9)%mod
            if d == prev:
                a = (a+1)%mod
            prev = d
            ans = (ans * a)%mod
    print(ans)


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