結果

問題 No.1086 桁和の桁和2
ユーザー googol_S0googol_S0
提出日時 2020-06-19 21:59:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 115,612 KB
最終ジャッジ日時 2023-09-16 14:08:59
合計ジャッジ時間 10,155 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,252 KB
testcase_01 AC 71 ms
71,228 KB
testcase_02 AC 71 ms
71,300 KB
testcase_03 AC 71 ms
71,300 KB
testcase_04 AC 78 ms
71,300 KB
testcase_05 AC 137 ms
108,800 KB
testcase_06 AC 71 ms
71,348 KB
testcase_07 AC 72 ms
71,352 KB
testcase_08 WA -
testcase_09 AC 74 ms
71,240 KB
testcase_10 AC 110 ms
92,280 KB
testcase_11 AC 81 ms
77,888 KB
testcase_12 AC 75 ms
75,732 KB
testcase_13 AC 122 ms
100,960 KB
testcase_14 AC 103 ms
90,972 KB
testcase_15 AC 134 ms
80,316 KB
testcase_16 AC 344 ms
108,776 KB
testcase_17 AC 111 ms
78,316 KB
testcase_18 WA -
testcase_19 AC 380 ms
112,468 KB
testcase_20 AC 125 ms
79,628 KB
testcase_21 AC 344 ms
108,764 KB
testcase_22 AC 440 ms
115,612 KB
testcase_23 AC 309 ms
104,472 KB
testcase_24 AC 237 ms
89,944 KB
testcase_25 AC 390 ms
114,900 KB
testcase_26 AC 335 ms
108,328 KB
testcase_27 AC 265 ms
94,904 KB
testcase_28 AC 233 ms
89,128 KB
testcase_29 WA -
testcase_30 AC 446 ms
114,224 KB
testcase_31 AC 447 ms
114,960 KB
testcase_32 WA -
testcase_33 AC 445 ms
114,700 KB
testcase_34 AC 446 ms
113,980 KB
testcase_35 AC 135 ms
108,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
L=list(map(int,input().split()))
R=list(map(int,input().split()))
D=list(map(int,input().split()))
for i in range(N-1):
  if D[i]!=0 and D[i+1]==0:
    print(0)
    exit()
DP=[[0]*9 for i in range(N+1)]
DP[0][0]=1
mod=10**9+7
X,Y=0,0
inv9=pow(9,mod-2,mod)
for i in range(N):
  if D[i]==0:
    DP[i+1][0]=1
    continue
  X=(pow(10,R[i]%(mod-1),mod)-1)*inv9%mod
  Y=(pow(10,L[i]%(mod-1),mod)-1)*inv9%mod
  for j in range(9):
    for k in range(9):
      DP[i+1][(j+k)%9]=(DP[i+1][(j+k)%9]+DP[i][j]*((0  if k else 1)+X-Y))%mod
  for j in range(9):
    if j!=D[i]%9:
      DP[i+1][j]=0
print(sum(DP[N]))
0