結果

問題 No.1085 桁和の桁和
ユーザー Kiri8128
提出日時 2020-06-20 01:32:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-11-06 17:40:46
合計ジャッジ時間 3,348 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

P = 10 ** 9 + 7
T = input()
D = int(input())
s = - D
c = 0
z = 1
for t in T:
    if t == "?":
        c += 1
    elif t != "0":
        z = 0
        s += int(t)
s %= 9
if D == 0:
    print(z)
else:
    print(((pow(10, c, P) + (-1 if s else 8)) * pow(9, P-2, P) - (D == 9) * z) % P)
0