結果
問題 | No.1085 桁和の桁和 |
ユーザー |
![]() |
提出日時 | 2020-06-19 23:02:40 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 551 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 77,196 KB |
最終ジャッジ日時 | 2024-07-23 00:38:24 |
合計ジャッジ時間 | 4,444 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 WA * 2 |
ソースコード
import sysinput = sys.stdin.readlineT=input().strip()D=int(input())mod=10**9+7Q=0W=0for t in T:if t=="?":Q+=1else:W+=int(t)DP=[0]*9DP[W%9]=1for t in range(Q):NDP=[0]*9for i in range(9):for j in range(9):if i==j:NDP[j]+=DP[i]*2else:NDP[j]+=DP[i]NDP[j]%=modDP=NDPif D==0:if set(T)<={"0","?"}:print(1)else:print(0)elif T=="?" and D==9:print(1)else:print(DP[D%9]%mod)