結果

問題 No.1085 桁和の桁和
ユーザー pluto77pluto77
提出日時 2020-06-29 09:41:21
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 285 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 8,416 KB
最終ジャッジ日時 2023-08-06 14:39:42
合計ジャッジ時間 5,876 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,880 KB
testcase_01 AC 15 ms
7,768 KB
testcase_02 AC 15 ms
7,820 KB
testcase_03 AC 15 ms
7,796 KB
testcase_04 AC 268 ms
8,228 KB
testcase_05 AC 15 ms
7,976 KB
testcase_06 AC 15 ms
7,892 KB
testcase_07 AC 15 ms
7,768 KB
testcase_08 AC 15 ms
7,928 KB
testcase_09 AC 16 ms
7,848 KB
testcase_10 AC 16 ms
7,920 KB
testcase_11 AC 16 ms
7,924 KB
testcase_12 AC 16 ms
7,840 KB
testcase_13 AC 33 ms
7,916 KB
testcase_14 AC 70 ms
8,196 KB
testcase_15 AC 142 ms
8,244 KB
testcase_16 AC 147 ms
8,328 KB
testcase_17 AC 74 ms
8,160 KB
testcase_18 AC 46 ms
7,868 KB
testcase_19 AC 131 ms
8,240 KB
testcase_20 AC 133 ms
8,216 KB
testcase_21 AC 88 ms
8,232 KB
testcase_22 AC 120 ms
8,416 KB
testcase_23 AC 25 ms
7,876 KB
testcase_24 AC 17 ms
7,844 KB
testcase_25 AC 81 ms
8,340 KB
testcase_26 AC 148 ms
8,348 KB
testcase_27 AC 123 ms
8,340 KB
testcase_28 AC 168 ms
8,200 KB
testcase_29 AC 94 ms
8,348 KB
testcase_30 AC 87 ms
8,252 KB
testcase_31 AC 141 ms
8,324 KB
testcase_32 AC 105 ms
8,320 KB
testcase_33 AC 275 ms
8,244 KB
testcase_34 AC 275 ms
8,248 KB
testcase_35 AC 284 ms
8,336 KB
testcase_36 AC 276 ms
8,396 KB
testcase_37 AC 285 ms
8,408 KB
testcase_38 AC 271 ms
8,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1085

mod=10**9+7
t=input()
d=int(input())
s=0
dp=[0]*9
dp[0]=1
sm=1
for i in t:
 if i!='?':
  s+=int(i)
 else:
  for j in range(9):
   dp[j]=(dp[j]+sm)%mod
  sm*=10
  sm%=mod
if d==0:
 if s==0:
  print(1)
 else:
  print(0)
elif s==0 and d==9:
 print(dp[0]-1)
else:
 print(dp[(d-s)%9])
0